Bug#686228: wordpress: plugin dirs cannot be symlinked due to plugin_basename bug
On Wednesday, September 12, 2012 at 15:09, Raphael Hertzog wrote: Right, it looks like we have to enhance plugin_basename() to be aware of the two possible locations of plugins. :-| I released 3.4.2+dfsg-1 with a fix for this issue. Can you verify whether the fix works for you? It seems to work. Thanks! Oskar -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#686228: wordpress: plugin dirs cannot be symlinked due to plugin_basename bug
Hello, On Thu, 30 Aug 2012, Raphael Hertzog wrote: Right, it looks like we have to enhance plugin_basename() to be aware of the two possible locations of plugins. :-| I released 3.4.2+dfsg-1 with a fix for this issue. Can you verify whether the fix works for you? Cheers, -- Raphaël Hertzog ◈ Debian Developer Get the Debian Administrator's Handbook: → http://debian-handbook.info/get/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#686228: wordpress: plugin dirs cannot be symlinked due to plugin_basename bug
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 (os...@osk.mine.nu) --- /usr/share/wordpress/wp-includes/plugin.php.v0 2012-08-30 07:53:17.170461007 + +++ /usr/share/wordpress/wp-includes/plugin.php 2012-08-30 08:10:05.126459994 + @@ -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 os...@vergic.com 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 os...@vergic.com 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 debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#686228: wordpress: plugin dirs cannot be symlinked due to plugin_basename bug
On Thu, 30 Aug 2012, Oskar Liljeblad wrote: 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.) The default value of WP_PLUGIN_DIR is (see wp-includes/default-constants.php): define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash And the default value of WP_CONTENT_DIR with the official Debian package is /var/lib/wordpress/wp-content so WP_PLUGIN_DIR points to /var/lib/wordpress/wp-content/plugins. Given the above, I believe that there should be no problems. Please check that you have a correct version of /usr/share/wordpress/wp-config.php. Cheers, -- Raphaël Hertzog ◈ Debian Developer Get the Debian Administrator's Handbook: → http://debian-handbook.info/get/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#686228: wordpress: plugin dirs cannot be symlinked due to plugin_basename bug
On Thursday, August 30, 2012 at 11:18, Raphael Hertzog wrote: 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.) The default value of WP_PLUGIN_DIR is (see wp-includes/default-constants.php): define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash And the default value of WP_CONTENT_DIR with the official Debian package is /var/lib/wordpress/wp-content so WP_PLUGIN_DIR points to /var/lib/wordpress/wp-content/plugins. Given the above, I believe that there should be no problems. Please check that you have a correct version of /usr/share/wordpress/wp-config.php. Looking at the bundled plugin, akismet, I see in /usr/share/wordpress/wp-content/plugins/akismet/admin.php at least one plugin_basename(__FILE__). Wouldn't this cause a problem because plugin_basename(/usr/share/wordpress/wp-content/plugins/akismet/admin.php) with WP_PLUGIN_DIR = /var/lib/wordpress/wp-content/plugins would return /usr/share/wordpress/wp-content/plugins/akismet/admin.php And that is not a basename - it's an absolute path... Oskar -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#686228: wordpress: plugin dirs cannot be symlinked due to plugin_basename bug
Hi, On Thu, 30 Aug 2012, Oskar Liljeblad wrote: Given the above, I believe that there should be no problems. Please check that you have a correct version of /usr/share/wordpress/wp-config.php. Looking at the bundled plugin, akismet, I see in /usr/share/wordpress/wp-content/plugins/akismet/admin.php at least one plugin_basename(__FILE__). Wouldn't this cause a problem because plugin_basename(/usr/share/wordpress/wp-content/plugins/akismet/admin.php) with WP_PLUGIN_DIR = /var/lib/wordpress/wp-content/plugins would return /usr/share/wordpress/wp-content/plugins/akismet/admin.php And that is not a basename - it's an absolute path... Right, it looks like we have to enhance plugin_basename() to be aware of the two possible locations of plugins. :-| I wonder if there are other similar pitfalls with this design choice. Cheers, -- Raphaël Hertzog ◈ Debian Developer Get the Debian Administrator's Handbook: → http://debian-handbook.info/get/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org