diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 03d33d5..57cf7bc 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -963,16 +963,32 @@ protected function initializeSettings(Request $request) { } } - // If the class loader is still the same, possibly upgrade to the APCu class - // loader. + // If the class loader is still the same, possibly upgrade to + // an optimized class loader. if ($class_loader_class == get_class($this->classLoader) - && Settings::get('class_loader_auto_detect', TRUE) - && function_exists('apcu_fetch')) { + && Settings::get('class_loader_auto_detect', TRUE)) { + $classloaders = array( + \Symfony\Component\ClassLoader\ApcClassLoader::class, + \Symfony\Component\ClassLoader\WinCacheClassLoader::class, + \Symfony\Component\ClassLoader\XcacheClassLoader::class, + ); $prefix = Settings::getApcuPrefix('class_loader', $this->root); - $apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $this->classLoader); - $this->classLoader->unregister(); - $apc_loader->register(); - $this->classLoader = $apc_loader; + $loader = NULL; + // Each one of these optimized loaders will verify that the + // required storage backends are available upon being instantiated + // and will throw an exception if not. + foreach ($classloaders as $loader_class) { + try { + $loader = new $loader_class($prefix, $this->classLoader); + break; + } + catch (\Exception $e) {} + } + if (!empty($loader)) { + $this->classLoader->unregister(); + $loader->register(); + $this->classLoader = $loader; + } } } diff --git a/core/rebuild.php b/core/rebuild.php index ccd4976..e9f8fae 100644 --- a/core/rebuild.php +++ b/core/rebuild.php @@ -42,9 +42,17 @@ ((REQUEST_TIME - $request->get('timestamp')) < 300) && Crypt::hashEquals(Crypt::hmacBase64($request->get('timestamp'), Settings::get('hash_salt')), $request->get('token')) )) { - // Clear the APCu cache to ensure APCu class loader is reset. - if (function_exists('apcu_clear_cache')) { - apcu_clear_cache(); + // Clear user cache for all major platforms. + $user_caches = array( + 'apc_clear_cache' => array('user'), + 'apcu_clear_cache' => array(), + 'wincache_ucache_clear' => array(), + 'xcache_clear_cache' => array(), + ); + foreach ($user_caches as $name => $args) { + if (function_exists($name)) { + call_user_func_array($name, $args); + } } drupal_rebuild($autoloader, $request); drupal_set_message('Cache rebuild complete.');