diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index ed776bf551..23524650c2 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -618,6 +618,19 @@ public function discoverServiceProviders() { // Retrieve enabled modules and register their namespaces. if (!isset($this->moduleList)) { $extensions = $this->getConfigStorage()->read('core.extension'); + // If core.extension configuration does not exist then the container + // cannot be dumped because Drupal is yet to be installed. + if ($extensions === FALSE && $this->environment !== 'testing' && !InstallerKernel::installationAttempted()) { + $this->allowDumping = FALSE; + $this->containerNeedsDumping = FALSE; + // If we're not in the installer, register the installer service + // provider to ensure that cache tables are not created. This is + // required to correctly redirect to the installer without creating any + // incorrect caches. This is not required when the installer is running + // because the installer manages the addition of its own service + // providers. + $GLOBALS['conf']['container_service_providers']['InstallerServiceProvider'] = 'Drupal\Core\Installer\InstallerServiceProvider'; + } $this->moduleList = isset($extensions['module']) ? $extensions['module'] : []; } $module_filenames = $this->getModuleFileNames(); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php index f5fb5dc225..56098c03ad 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php @@ -54,6 +54,15 @@ protected function prepareEnvironment() { mkdir($this->settings['settings']['config_sync_directory']->value, 0777, TRUE); } + /** + * Visits the interactive installer. + */ + protected function visitInstaller() { + // Should redirect to the installer. + $this->drupalGet($GLOBALS['base_url']); + $this->assertSession()->addressEquals($GLOBALS['base_url'] . '/core/install.php'); + } + /** * {@inheritdoc} */ diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php index 699f26f87d..8e4efe4b59 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php @@ -256,9 +256,9 @@ protected function setUpRequirementsProblem() { protected function setUpSite() { $edit = $this->translatePostValues($this->parameters['forms']['install_configure_form']); $this->drupalPostForm(NULL, $edit, $this->translations['Save and continue']); - // If we've got to this point the site is installed using the regular - // installation workflow. - $this->isInstalled = TRUE; + // If we've got to this point and the request is successful, the site is + // installed using the regular installation workflow. + $this->isInstalled = $this->getSession()->getStatusCode() === 200; } /**