diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index d79cf8f..f6ee5f1 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -20,6 +20,8 @@ use Drupal\Core\Site\Settings; use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\ClassLoader\ApcClassLoader; +use Symfony\Component\ClassLoader\WinCacheClassLoader; +use Symfony\Component\ClassLoader\XcacheClassLoader; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -46,21 +48,6 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { /** - * Platform specific optimized class loaders. - * - * Autodetection tries to initialize these in the - * order they appear in the array. They are ordered - * in terms of "adoption/usage". - * - * @var string[] - */ - protected $classLoaders = [ - \Symfony\Component\ClassLoader\ApcClassLoader::class, - \Symfony\Component\ClassLoader\WinCacheClassLoader::class, - \Symfony\Component\ClassLoader\XcacheClassLoader::class, - ]; - - /** * Holds the class used for dumping the container to a PHP array. * * In combination with swapping the container class this is useful to e.g. @@ -1022,16 +1009,17 @@ protected function initializeSettings(Request $request) { && Settings::get('class_loader_auto_detect', TRUE)) { $prefix = Settings::getApcuPrefix('class_loader', $this->root); $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 ($this->classLoaders as $loader_class) { - try { - $loader = new $loader_class($prefix, $this->classLoader); - break; - } - catch (\Exception $e) {} + + // We autodetect one of the following three optimized classloaders, if + // their underlying extension exists. + if (function_exists('apcu_fetch')) { + $loader = new ApcClassLoader($prefix, $this->classLoader); + } + elseif (extension_loaded('wincache')) { + $loader = new WinCacheClassLoader($prefix, $this->classLoader); + } + elseif (extension_loaded('xcache')) { + $loader = new XcacheClassLoader($prefix, $this->classLoader); } if (!empty($loader)) { $this->classLoader->unregister();