[wp-trac] [WordPress Trac] #13550: WP_PLUGIN_DIR doesn't detect symlinks

WordPress Trac wp-trac at lists.automattic.com
Sun Oct 17 14:13:55 UTC 2010


#13550: WP_PLUGIN_DIR doesn't detect symlinks
---------------------------+------------------------------------------------
 Reporter:  acumensystems  |        Owner:  westi   
     Type:  enhancement    |       Status:  reopened
 Priority:  normal         |    Milestone:  3.1     
Component:  Plugins        |      Version:  3.0     
 Severity:  minor          |   Resolution:          
 Keywords:  has-patch      |  
---------------------------+------------------------------------------------

Comment(by vladimir_kolesnikov):

 > Now we have one of the plugin_ functions working in this case and the
 others don't.

 Well, smth like that (oversimplified):

 {{{
 function my_plugin_basename($file)
 {
     static $my_paths = array('var/www/storage1/', 'var/www/storage2');
     foreach ($my_paths as $path) {
         $file = str_replace($path, '', $file);
     }

     return $file;
 }

 add_filter('plugin_basename', 'my_plugin_basename');
 }}}

 $my_paths lists all possible destinations for the shared plugin locations
 and in the loop we remove them from $file (the real logic will be more
 complicated). The result will be plugin_dir/plugin_file — basically what
 plugin_basename() returns for the plugins located in WP(MU)_PLUGIN_DIR.

 register_XXX_hook(), add_XXX_page(), plugins_dir/url() functions all rely
 upon plugin_basename() and with my_plugin_basename hook installed the
 resulting path/url will be correct.

 > Also how are these plugins going to interact with the built-in upgrader.

 What do you mean?

 Wrt to #15134, the upgrader will remove the symlink only from the blog
 being updated leaving all others unaffected.

 > there are better ways to support sharing plugins across multiple WP
 installs.

 I'd really love to know about them. But in the case when only some plugins
 are shared between the blogs I cannot imagine other solution than
 symlinking.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13550#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list