diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 6e251b9..5fe4287 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -975,16 +975,14 @@ protected function initializeSettings(Request $request) { if ($class_loader_class == get_class($this->classLoader) && Settings::get('class_loader_auto_detect', TRUE) && function_exists('apc_fetch')) { - // We need to hash any file path within the vendor directory, so that we - // can modify our APC identifier with it. That way, if someone moves the - // vendor directory, ApcClassLoader won't crash. We choose Request because - // this function wouldn't be executing if the class loader didn't already - // know where it is. - // @todo: Maybe remove this after https://www.drupal.org/node/2380389 + // We need a file path to a class which should be in the vendor directory, + // so that we can modify our APC identifier hash with it. We do this so + // that if someone moves the vendor directory, ApcClassLoader won't fail + // to load the classes contained within it. We use the path to the Request + // class because we know the classloader has already found it. + // @todo: Consider removing this after https://www.drupal.org/node/2380389 $request_class_path = $this->classLoader->findFile('Symfony\Component\HttpFoundation\Request'); - // @todo: figure out a better way to make this hash. - $identifier = 'class_loader_' . hash_hmac('sha256', $request_class_path, ''); - $prefix = Settings::getApcuPrefix($identifier, $this->root); + $prefix = Settings::getApcuPrefix('class_loader', $this->root, $request_class_path); $apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $this->classLoader); $this->classLoader->unregister(); $apc_loader->register(); diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php index 21298b4..5a972dc 100644 --- a/core/lib/Drupal/Core/Site/Settings.php +++ b/core/lib/Drupal/Core/Site/Settings.php @@ -161,9 +161,14 @@ public static function getHashSalt() { * module directories setting apcu_ensure_unique_prefix would allow the sites * to share APC cache items. * - * @param $identifier + * @param string $identifier * An identifier for the prefix. For example, 'class_loader' or * 'cache_backend'. + * @param string $root + * The root directory of the Drupal installation. + * @param string $site_path + * (optional) The multisite site path, useful for SimpleTest. Can be an + * arbitrary string as well. Defaults to an empty string. * * @return string * The prefix for APC user cache keys.