Don't try to resolve symlinks for single-file plugins. plugins_url() should not be used in this context anyway.

props rmccue.
fixes #16953.


git-svn-id: https://develop.svn.wordpress.org/trunk@27999 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2014-04-07 20:14:34 +00:00
parent 4d4921a9ac
commit e724e1b06f
2 changed files with 14 additions and 1 deletions

View File

@ -638,16 +638,30 @@ function plugin_basename( $file ) {
* This is used in {@see plugin_basename()} to resolve symlinked paths. * This is used in {@see plugin_basename()} to resolve symlinked paths.
* *
* @param string $file Known path to the file. * @param string $file Known path to the file.
* @return bool Whether the path was able to be registered.
*/ */
function wp_register_plugin_realpath( $file ) { function wp_register_plugin_realpath( $file ) {
global $wp_plugin_paths; global $wp_plugin_paths;
// Normalize, but store as static to avoid recalculation of a constant value
static $wp_plugin_path, $wpmu_plugin_path;
if ( ! isset( $wp_plugin_path ) ) {
$wp_plugin_path = wp_normalize_path( WP_PLUGIN_DIR );
$wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR );
}
$plugin_path = wp_normalize_path( dirname( $file ) ); $plugin_path = wp_normalize_path( dirname( $file ) );
$plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) ); $plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) );
if ( $plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path ) {
return false;
}
if ( $plugin_path !== $plugin_realpath ) { if ( $plugin_path !== $plugin_realpath ) {
$wp_plugin_paths[ $plugin_path ] = $plugin_realpath; $wp_plugin_paths[ $plugin_path ] = $plugin_realpath;
} }
return true;
} }
/** /**

View File

@ -168,7 +168,6 @@ $GLOBALS['wp_plugin_paths'] = array();
// Load must-use plugins. // Load must-use plugins.
foreach ( wp_get_mu_plugins() as $mu_plugin ) { foreach ( wp_get_mu_plugins() as $mu_plugin ) {
wp_register_plugin_realpath( $mu_plugin );
include_once( $mu_plugin ); include_once( $mu_plugin );
} }
unset( $mu_plugin ); unset( $mu_plugin );