diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 8ae5924..ac403a7 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -964,16 +964,31 @@ protected function initializeSettings(Request $request) { } } - // If the class loader is still the same, possibly upgrade to the APC class + // 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('apc_fetch')) { + && Settings::get('class_loader_auto_detect', TRUE)) { $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; + $classloaders = array( + \Symfony\Component\ClassLoader\ApcClassLoader::class, + \Symfony\Component\ClassLoader\WinCacheClassLoader::class, + \Symfony\Component\ClassLoader\XcacheClassLoader::class); + $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 ffbe69e..f9c782e 100644 --- a/core/rebuild.php +++ b/core/rebuild.php @@ -42,12 +42,16 @@ ((REQUEST_TIME - $request->get('timestamp')) < 300) && ($request->get('token') === Crypt::hmacBase64($request->get('timestamp'), Settings::get('hash_salt'))) )) { - // Clear the APC cache to ensure APC class loader is reset. - if (function_exists('apc_clear_cache')) { - apc_clear_cache('user'); - } - 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(), + ); + 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.');