[wp-trac] [WordPress Trac] #16953: Allow symlinked plugins
WordPress Trac
noreply at wordpress.org
Sun Feb 10 10:25:10 UTC 2013
#16953: Allow symlinked plugins
------------------------------------+-----------------------------
Reporter: scribu | Owner:
Type: enhancement | Status: assigned
Priority: normal | Milestone: Future Release
Component: Plugins | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch dev-feedback |
------------------------------------+-----------------------------
Changes (by MikeSchinkel):
* cc: mike@… (added)
* keywords: has-patch => has-patch dev-feedback
* version: => trunk
Comment:
I've uploaded a path with another approach. The patch hooks
`'pre_update_option_active_plugins'` so anytime `'active_plugins'` is
saved it finds which active plugins have been symlinked and saves an
array to a `'symlinked_plugins'` key of `wp_options`. The array has an
element for each of the symlinked plugins with the array key being
`realpath( $virtual_plugin_file )` and the value being
`virtual_plugin_file`, i.e.
{{{
update_options( 'symlinked_plugins', array(
'/Users/user/Plugins/my-plugin-1/my-plugin-1.php' =>
'/Users/user/Sites/test/wp-content/plugins/my-plugin-1/my-
plugin-1.php',
'/Users/user/Plugins/my-plugin-2/my-plugin-2.php' =>
'/Users/user/Sites/test/wp-content/plugins/my-plugin-2/my-
plugin-2.php',
));
}}}
Then `plugins_url()` simply checks to see if the value of the `$plugin`
parameter -- which is typically passed in as `__FILE__` -- is a key in the
array returned by `get_option( 'symlinked_plugins' )` and if yes it
assigns `$plugin` with that array element's value.
I think that's all it takes. I've been circling this problem for a while
so maybe this is all we need to enable `plugins_url()` to work correctly
with symlinked plugins. But I might have missed a requirement and if so
will need others to point out what I've missed.
Also please consider this a starting point for discussion; I don't expect
that it's completely ready for production, but crossing fingers it might
be.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16953#comment:41>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list