[wp-trac] [WordPress Trac] #28441: Errant activation hook with symlinked plugins in WordPress 3.9.x
WordPress Trac
noreply at wordpress.org
Sat Jan 17 15:28:34 UTC 2015
#28441: Errant activation hook with symlinked plugins in WordPress 3.9.x
--------------------------+------------------------------
Reporter: clifgriffin | Owner: rmccue
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 3.9
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by jdgrimes):
FWIW, [attachment:wp-plugin-paths.php] is an example solution. It is
implemented as new static class because it is based off of a solution from
a project of mine that had a similar issue. The
`wp_register_plugin_realpath()` function is replaced by
`WP_Plugin_Paths::register()` and the code in `plugin_basename()` that
currently resolves the paths is replaced by `WP_Plugin_Paths::resolve()`.
The reason this was originally a class is to avoid a global variable. And
it was also more efficient, because it allows us to use the `ksort()`
function, and only to sort the paths when it is needed.
For backward compatibility with the current implementation, we may want to
keep using a global variable instead. However, that will also mean that
we'll need to sort the paths each time we need to resolve them, and use a
different, much less efficient method of sorting the paths. That is,
unless we change the array structure of the global, which would be
backward incompatible for anyone hacking `$wp_plugin_paths` anyway.
So as a summary of this solution, if implemented as a class like this:
'''Pro:''' it will be much more efficient at resolving the paths than
otherwise (I don't know how significant this is though, I haven't
benchmarked anything).
'''Con:''' it isn't backward compatible for anyone hacking
`$wp_plugin_paths`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28441#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list