Add a workaround for realpath() failing to process the mu-plugins path.

Probably fixes #251
This commit is contained in:
Yahnis Elsts 2018-12-30 13:36:24 +02:00
parent d98d6bc6ca
commit 9d087b7d9c
1 changed files with 10 additions and 0 deletions

View File

@ -160,9 +160,19 @@ if ( !class_exists('Puc_v4p5_Plugin_Package', false) ):
static $cachedResult = null;
if ( $cachedResult === null ) {
if ( !defined('WPMU_PLUGIN_DIR') || !is_string(WPMU_PLUGIN_DIR) ) {
$cachedResult = false;
return $cachedResult;
}
//Convert both paths to the canonical form before comparison.
$muPluginDir = realpath(WPMU_PLUGIN_DIR);
$pluginPath = realpath($this->pluginAbsolutePath);
//If realpath() fails, just normalize the syntax instead.
if (($muPluginDir === false) || ($pluginPath === false)) {
$muPluginDir = Puc_v4p5_Factory::normalizePath(WPMU_PLUGIN_DIR);
$pluginPath = Puc_v4p5_Factory::normalizePath($this->pluginAbsolutePath);
}
$cachedResult = (strpos($pluginPath, $muPluginDir) === 0);
}