[wp-trac] [WordPress Trac] #42573: Templates not working properly

WordPress Trac noreply at wordpress.org
Tue Nov 21 16:53:34 UTC 2017


#42573: Templates not working properly
--------------------------+--------------------
 Reporter:  precies       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  high          |   Milestone:  4.9.1
Component:  Themes        |     Version:  4.9
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+--------------------

Comment (by westonruter):

 Replying to [comment:56 maximejobin]:
 > - Why was this feature introduced ? What problem does it solve? If
 any...

 See above. It's related to changes in the file editor in #6531 via r41806.
 In previous version of WordPress, files would only be listed 2-levels
 deep. In 4.9, the entire directory tree for a theme is now listed
 regardless of depth. Recursively gathering a list of files can be
 expensive for large themes, so that is why caching was enabled. An
 unintended side effect of the caching is that the same directory listing
 function `get_files` is used both for the theme editor and for gathering
 page templates.

 One change could be to only use caching when calling `get_files` with a
 `$depth` greater than 1. Note that `get_post_templates` will explicitly
 call `get_files` with a `$depth` of 1 already.  I believe the only place
 where infinite depth of -1 is used is for the theme editor, and in that
 low-traffic'ed place, caching may be overkill anyway. So as long as we can
 confirm that infinite depth calls to `get_files` is limited to file
 editor, I would +1 removal of the caching.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42573#comment:57>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list