Skip to content

Commit

Permalink
Don't try to resolve symlinks for single-file plugins. plugins_url() …
Browse files Browse the repository at this point in the history
…should not be used in this context anyway.

props rmccue.
fixes #16953.

Built from https://develop.svn.wordpress.org/trunk@27999


git-svn-id: http://core.svn.wordpress.org/trunk@27829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Apr 7, 2014
1 parent f6df2c6 commit 0b57292
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 14 additions & 0 deletions wp-includes/plugin.php
Expand Up @@ -638,16 +638,30 @@ function plugin_basename( $file ) {
* This is used in {@see plugin_basename()} to resolve symlinked paths.
*
* @param string $file Known path to the file.
* @return bool Whether the path was able to be registered.
*/
function wp_register_plugin_realpath( $file ) {
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_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 ) {
$wp_plugin_paths[ $plugin_path ] = $plugin_realpath;
}

return true;
}

/**
Expand Down
1 change: 0 additions & 1 deletion wp-settings.php
Expand Up @@ -168,7 +168,6 @@

// Load must-use plugins.
foreach ( wp_get_mu_plugins() as $mu_plugin ) {
wp_register_plugin_realpath( $mu_plugin );
include_once( $mu_plugin );
}
unset( $mu_plugin );
Expand Down

0 comments on commit 0b57292

Please sign in to comment.