Package: wordpress
Version: 3.4.1+dfsg-1
Severity: normal

With the current Debian WordPress directory layout with
/usr/share/wordpress/wp-content and /var/lib/wordpress/wp-content
(and perhaps /var/www/yoursite/wp-content) it is
basically implied that you should symlink plugin directories.
Now most plugins use plugin_basename(__FILE__) to determine their basename.
It is assumed that this function returns a relative directory, but it doesn't
if the plugin is not "physically located" in WP_PLUGIN_DIR (or WPMU_PLUGIN_DIR).
(With physically located I mean located according to realpath (without
symlinks) - the plugin may still be reachable through WP_PLUGIN_DIR.)

This patch fixes the problem but it is crude. I can imagine that there is a
better fix.  Perhaps plugins should not use __FILE__ to refer to their
location, but it seems most do.

Regards,

Oskar Liljeblad ([email protected])

--- /usr/share/wordpress/wp-includes/plugin.php.v0      2012-08-30 
07:53:17.170461007 +0000
+++ /usr/share/wordpress/wp-includes/plugin.php 2012-08-30 08:10:05.126459994 
+0000
@@ -565,6 +565,11 @@
        $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for 
Win32 installs
        $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove 
any duplicate slash
        $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . 
preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from 
plugins dir
+       # Begin Oskar Liljeblad <[email protected]> 2012-08-30
+       $sys_plugin_dir1 = '/usr/share/wordpress/wp-content/plugins';
+       $sys_plugin_dir2 = '/var/lib/wordpress/wp-content/plugins';
+       $file = preg_replace('#^' . preg_quote($sys_plugin_dir1, '#') . '/|^' . 
preg_quote($sys_plugin_dir2, '#') . '/#','',$file); // get relative path from 
plugins dir
+       # End Oskar Liljeblad <[email protected]> 2012-08-30
        $file = trim($file, '/');
        return $file;
 }



-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to