[wp-trac] [WordPress Trac] #41346: Introduce a hook for individual plugin loaded
WordPress Trac
noreply at wordpress.org
Tue Jan 22 17:30:40 UTC 2019
#41346: Introduce a hook for individual plugin loaded
--------------------------------------+-----------------------------
Reporter: Rarst | Owner: SergeyBiryukov
Type: feature request | Status: reopened
Priority: normal | Milestone: 5.1
Component: Plugins | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-dev-note | Focuses: performance
--------------------------------------+-----------------------------
Comment (by Rarst):
Good catch! Somehow I was sure those are basenames, though now that you
pointed it out obviously they need to be full paths to be correctly
included. Hashtag embarrassed.
As a note on your patch the `plugin_basename()` should probably be used
for consistent result and normalization of path.
However I question do we really care that path is full? Effectively it's
just more complete set of information.
Also I need to point out that `folder/filename.php` is not a reliable
signature of plugin. There are scenarios where plugin is defacto installed
in a'' different folder name from what original developer intended''.
That's why the best practice is to always ''calculate'' actual basename on
plugin boot, rather than hardcode it.
So providing basenames can be somewhat encouraging to hardcoded checks.
So I suggest we just stick with full path and change inline documentation
accordingly. If basename is needed it can be extracted out of full path as
necessary by a callback.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41346#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list