diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 7d390ce..32fc560 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -253,7 +253,7 @@ public static function createFromRequest(Request $request, $class_loader, $envir && Settings::get('class_loader_auto_detect', TRUE) && Settings::get('hash_salt', FALSE) && function_exists('apc_fetch')) { - $prefix = 'drupal.' . hash_hmac('sha256', 'drupal', Settings::getHashSalt()); + $prefix = $this->getApcKey('class_loader'); $apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $class_loader); $class_loader->unregister(); $apc_loader->register(); @@ -431,7 +431,7 @@ public function boot() { } } FileCacheFactory::setConfiguration($configuration); - FileCacheFactory::setPrefix(hash_hmac('sha256', 'FileCache', Settings::getHashSalt())); + FileCacheFactory::setPrefix($this->getApcKey('file_cache')); // Initialize the container. $this->initializeContainer(); @@ -1359,4 +1359,17 @@ protected function addServiceFiles($service_yamls) { } return FALSE; } + + /** + * Generates a cache for use in the APC cache. + * + * @param string $cid + * The cache ID of the data to retrieve. + */ + protected static function getApcKey($cid) { + // @todo: This should be using Settings::getHashSalt(). + // @see https://www.drupal.org/node/2474077 + return 'drupal.' . $cid . hash_hmac('sha256', $cid, Settings::get('hash_salt')); + } + }