Index: public_html/wp-includes/plugin.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- public_html/wp-includes/plugin.php (revision 23400)
+++ public_html/wp-includes/plugin.php (revision )
@@ -563,6 +563,9 @@
* @uses WP_PLUGIN_DIR
*/
function plugin_basename($file) {
+ $symlinked_plugins = get_option( 'symlinked_plugins' );
+ if ( isset( $symlinked_plugins[$file] ) )
+ $file = $symlinked_plugins[$file];
$file = str_replace('\\','/',$file); // sanitize for Win32 installs
$file = preg_replace('|/+|','/', $file); // remove any duplicate slash
$plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
@@ -787,3 +790,39 @@
return $function[0].$function[1];
}
}
+
+/**
+ * Stores array of symlinked plugins upon update of 'active_plugins' into 'symlinked_plugins' option.
+ *
+ * The array stored for 'symlinked_plugins' will be in the following form assuming that $plugin_virtual_path contains
+ * an array of full virtual plugin paths where each is in the form WP_PLUGIN_DIR . "/{plugin_slug}":
+ *
+ * array(
+ * realpath( $plugin_virtual_path[1] ) => $plugin_virtual_path[1],
+ * realpath( $plugin_virtual_path[2] ) => $plugin_virtual_path[2],
+ * realpath( $plugin_virtual_path[3] ) => $plugin_virtual_path[3],
+ * );
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @access private
+ * @since 3.6
+ * @link http://core.trac.wordpress.org/ticket/16953
+ *
+ * @param mixed $plugin_slugs The newly changed array of 'active_plugins' being saved.
+ * @return mixed Array of full plugin filepaths where key is realpath( $virtual_path ) and value is $virtual_path.
+ */
+function _wp_pre_update_option_active_plugins( $plugin_slugs ) {
+ $symlinked_plugins = array();
+ foreach( $plugin_slugs as $plugin_slug ) {
+ $real_path = realpath( $virtual_path = WP_PLUGIN_DIR . "/{$plugin_slug}" );
+ if ( $real_path != $virtual_path )
+ $symlinked_plugins[$real_path] = $virtual_path;
+ }
+ if ( count( $symlinked_plugins ) )
+ update_option( 'symlinked_plugins', $symlinked_plugins );
+ else
+ delete_option( 'symlinked_plugins' );
+ return $plugin_slugs;
+}
+add_filter( 'pre_update_option_active_plugins', '_wp_pre_update_option_active_plugins' );