We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31539
    • 1 Posts
    Hey,

    Is there anyway that I can find and delete the unused templates, chunks, snippets from the site. I am using Modx 1.0.2
    I checked in the database; all I got is lots of info about templates, chunks, snippets. But did not find anything that says whether they are being used or left un-used.

    Thanks
      • 3749
      • 24,544 Posts
      There’s no way to do that at present. It’s very difficult to tell which elements are being used and which are not. And it’s impossible to tell which elements you might be going to use in the future, so having that feature would risk removing important elements that would be a real pain to replace.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 31539
        • 1 Posts
        Ok, thanks bobray.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Even scanning the database for tags isn’t reliable, since snippet code can be accessing snippets, chunks and TVs with API calls.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 22427
            • 793 Posts
            At least for the templates there is a way to do it manually - for each template:
            Try to delete the template. If the template is in use, a warning will appear, so you just do not delete it in that case.
            For a chunk or a snippet MODx cannot decide whether it is in use ore not.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              That’s because the template a resource uses is a record in the database, so the database can be checked to see what resources are using it. There aren’t any tags for templates wink And even then, if you’re using some kind of dynamic template switcher, you could delete a template that is used by the switcher and not originally assigned to the resource.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 22427
                • 793 Posts
                Ah, I see ... rolleyes
                  • 31539
                  • 1 Posts
                  yes we can check for templates in the database.