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

WordPress Trac wp-trac at lists.automattic.com
Tue Jun 1 13:08:31 UTC 2010


#13550: WP_PLUGIN_DIR doesn't detect symlinks
---------------------------+------------------------------------------------
 Reporter:  acumensystems  |        Owner:  westi  
     Type:  enhancement    |       Status:  closed 
 Priority:  normal         |    Milestone:         
Component:  Plugins        |      Version:  3.0    
 Severity:  minor          |   Resolution:  wontfix
 Keywords:                 |  
---------------------------+------------------------------------------------
Changes (by acumensystems):

 * cc: acumensystems (added)


Comment:

 Hi

 Yes, readlink does return an absolute path, which is what the WP plugin
 directory will often and happily be. The problems I was describing use
 plugin_basename, and an absolute path is very much what they expect. I
 have tested the patch working, you can recreate by adding the symlink I
 described.

 The variable returned by readlink, and the many of the checks in
 plugin_basename are simply to help "remove" parts of the path that are not
 wanted in the final plugin path to be returned. Without my patch,
 plugin_basename will return a double length path containing everything
 before the symlink twice, and everything after it once. Simply, the result
 is incorrect, and if WP can not determine the path, it should return false
 and be error-handled.

 I do appreciate that these constants are available, but I do also think
 that the assumption made by WP could be a little more robust, as it is a
 common approach for developers to use symlinks to get all their "dynamic"
 resources in one place, if the structure of software needs them from
 various subdirectories at different levels of the main project tree - i.e.
 /wp-content/uploads, wp-content/themes, and plugins/ are the dynamic paths
 here.

 So I feel this patch helps work around what would otherwise be the
 suggestion that all "user" data for WP is kept in a single common parent
 directory. I appeal for you to test and validate my patch as it only adds
 to the robustness of WPs behaviour, and it does not decrease efficiency or
 complexity in any significant way.

 Thanks for your time,
 Leo

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


More information about the wp-trac mailing list