diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index d6c6f45..865a12f 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -178,6 +178,13 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { protected $containerNeedsDumping; /** + * Whether the container can be cached. + * + * @var bool + */ + protected $allowCaching = TRUE; + + /** * List of discovered services.yml pathnames. * * This is a nested array whose top-level keys are 'app' and 'site', denoting @@ -865,7 +872,7 @@ protected function initializeContainer() { \Drupal::setContainer($this->container); // If needs dumping flag was set, dump the container. - if ($this->containerNeedsDumping && !$this->cacheDrupalContainer($container_definition)) { + if ($this->allowCaching && $this->containerNeedsDumping && !$this->cacheDrupalContainer($container_definition)) { $this->container->get('logger.factory')->get('DrupalKernel')->notice('Container cannot be saved to cache.'); } diff --git a/core/lib/Drupal/Core/Update/UpdateKernel.php b/core/lib/Drupal/Core/Update/UpdateKernel.php index 80f243c..2c9035f 100644 --- a/core/lib/Drupal/Core/Update/UpdateKernel.php +++ b/core/lib/Drupal/Core/Update/UpdateKernel.php @@ -27,6 +27,16 @@ class UpdateKernel extends DrupalKernel { /** + * Whether the container can be cached. + * + * Don't cache this particular container, so it does not leak into the main + * site at all. + * + * @var bool + */ + protected $allowCaching = FALSE; + + /** * {@inheritdoc} */ public function discoverServiceProviders() { @@ -49,15 +59,6 @@ protected function initializeContainer() { /** * {@inheritdoc} */ - protected function cacheDrupalContainer(array $container_definition) { - // Don't save this particular container to cache, so it does not leak into - // the main site at all. - return FALSE; - } - - /** - * {@inheritdoc} - */ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) { try { static::bootEnvironment();