[wp-trac] [WordPress Trac] #6531: Recursively search for files in theme and plugin editors
WordPress Trac
noreply at wordpress.org
Wed Oct 4 20:20:56 UTC 2017
#6531: Recursively search for files in theme and plugin editors
-------------------------------------------------+-------------------------
Reporter: torbens | Owner:
Type: defect (bug) | WraithKenny
Priority: high | Status: reviewing
Component: Themes | Milestone: 4.9
Severity: minor | Version: 2.5
Keywords: theme-editor has-patch needs-unit- | Resolution:
tests | Focuses:
| administration
-------------------------------------------------+-------------------------
Comment (by schlessera):
@WraithKenny :
> particularly the "empty set" condition. I'm not sure I fully understand
the implications however, since an empty set would cause the function to
scan for 0 files when the theme editor is loaded.
The main issue was that caching would have been disabled as a side effect,
thus fetching from cache every single time, failing every single time, and
then starting to look through the filesystem every single time.
With the check for `false` you did now, the cache will be checked only
once, and it will correctly cache the fact that it didn't find any files.
> As for PHP recursive iterators, I'm not too familiar with them, but I'll
research after work to see what I can do, unless you'd like to take a stab
at it :) Thanks for the feedback!
I will see if I can manage to fit in that change before the deadline...
Additionally:
- I'd suggest having a way to define/override the exclusions for
`list_files()` through the function call, and putting the filters outside
of that "reusable" function. I don't think the filter conceptually fits
into the `list_files()` implementation.
- The transient name needs to be truncated to control the length, to avoid
running into obscure bugs where a long directory name breaks the caching.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/6531#comment:57>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list