diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 6e9d8b9..d87db0f 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -62,6 +62,13 @@ class DrupalKernel extends Kernel implements DrupalKernelInterface { protected $extensionHandler; /** + * Whether the container needs to be dumped to PHP. + * + * @var boolean + */ + protected $containerNeedsDumping = FALSE; + + /** * Constructs a DrupalKernel object. * * @param string $environment @@ -110,6 +117,9 @@ public function boot() { $this->extensionHandler = new ExtensionHandler($this->keyValue, CacheFactory::get('cache'), CacheFactory::get('bootstrap'), $class_loader); parent::boot(); drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE); + if ($this->containerNeedsDumping && !$this->dumpDrupalContainer($this->container, $this->getContainerBaseClass())) { + watchdog('DrupalKernel', 'Container cannot be written to disk'); + } } /** @@ -172,10 +182,8 @@ protected function initializeContainer() { } if (!isset($this->container)) { $this->container = $this->buildContainer(); - if ($this->compilationIndexCache && !$this->dumpDrupalContainer($this->container, $this->getContainerBaseClass())) { - // We want to log this as an error but we cannot call watchdog() until - // the container has been fully built and set in drupal_container(). - $error = 'Container cannot be written to disk'; + if ($this->compilationIndexCache) { + $this->containerNeedsDumping = TRUE; } } @@ -184,10 +192,6 @@ protected function initializeContainer() { $this->container->set('extension_handler', $this->extensionHandler); $this->container->set('keyvalue', $this->keyValue); drupal_container($this->container); - - if (isset($error)) { - watchdog('DrupalKernel', $error); - } } /**