1

I have inherited a large EE site (upgraded to 2.9.2) that is, frankly, a mess on the backend (EE CP). There are many template groups and templates that appear to have been left behind from multiple site redesign iterations over the past 6 years and I am not sure if they are used any more, and even if they are, where they are used. Additionally they are not saved to disk - they are just stored in the db - and I want to version control all the templates, but only what is current, not the legacy junk, so I need to turn back on template writing to disk, at the very least to initially dump out the used templates so I can get them into Git.

I want to clean it up for both my and my content creators sanity. Is there a simple way (I don't care whether it is via the EE CP, PHP, or MySQL CLI - I am fluent in all) that I can easily determine if a template is used on any Pages in the site? If I used the MySQL CLI which EE table(s) should I be searching for? Are templates stored in the db by name, or as key-value pairs (PK integer and name), and are the templates names/PK integer used as foreign keys in other tables? I need to know how to isolate everything unused.

Thanks in advance.

3

There's a similar post here

But you could just look in the template debugging info.

Another option would be to add something to each template that shows its name (either output to screen or as an HTML comment).

Of course, you would then need to traverse the whole site and note which templates were used, and which ones weren't. Which would possibly be extremely time consuming.

| improve this answer | |
  • Thanks for the answer - that is helpful. One comment: if the template is never called, how would there even be any template debugging info? – tatlar Jan 15 '15 at 17:01
2

AFIAK there is no quick/easy/simple way. You're on the hook for trying to generate every page within the site and reverse-engineering it to see what templates were involved. With Templates Routes now possible this chore will get even harder.

I have lobbied in the past for an addon that would not only do this, but find all the cruft in a legacy install - fields/channels/categories etc. I think it's worthy of a commercial add-on offering.

| improve this answer | |
  • Thanks for the answer. Agreed that this is worthy of a paid plugin. With over 5 inherited large EE sites there is a degree of pain I am going to feel figuring this out that could be alleviated with $100 for a plugin. Maybe I should just do it myself, at least to solve my particular problem. – tatlar Jan 15 '15 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.