Skip to content
Snippets Groups Projects
Commit eae7058a authored by catch's avatar catch
Browse files

Issue #3103529 by alexpott, mcdruid, Chris Burge, greg.1.anderson, rfay,...

Issue #3103529 by alexpott, mcdruid, Chris Burge, greg.1.anderson, rfay, anavarre, catch, Gábor Hojtsy: Drupal 8.8.1+ and 9 can fail to install in the web browser due to cache pollution
parent c4f0d962
No related branches found
No related tags found
6 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards
...@@ -618,6 +618,20 @@ public function discoverServiceProviders() { ...@@ -618,6 +618,20 @@ public function discoverServiceProviders() {
// Retrieve enabled modules and register their namespaces. // Retrieve enabled modules and register their namespaces.
if (!isset($this->moduleList)) { if (!isset($this->moduleList)) {
$extensions = $this->getConfigStorage()->read('core.extension'); $extensions = $this->getConfigStorage()->read('core.extension');
// If core.extension configuration does not exist and we're not in the
// installer itself, then we need to put the kernel into a pre-installer
// mode. The container should not be dumped because Drupal is yet to be
// installed. The installer service provider is registered to ensure that
// cache and other automatically created tables are not created if
// database settings are available. None of this is required when the
// installer is running because the installer has its own kernel and
// manages the addition of its own service providers.
// @see install_begin_request()
if ($extensions === FALSE && !InstallerKernel::installationAttempted()) {
$this->allowDumping = FALSE;
$this->containerNeedsDumping = FALSE;
$GLOBALS['conf']['container_service_providers']['InstallerServiceProvider'] = 'Drupal\Core\Installer\InstallerServiceProvider';
}
$this->moduleList = isset($extensions['module']) ? $extensions['module'] : []; $this->moduleList = isset($extensions['module']) ? $extensions['module'] : [];
} }
$module_filenames = $this->getModuleFileNames(); $module_filenames = $this->getModuleFileNames();
......
...@@ -54,6 +54,17 @@ protected function prepareEnvironment() { ...@@ -54,6 +54,17 @@ protected function prepareEnvironment() {
mkdir($this->settings['settings']['config_sync_directory']->value, 0777, TRUE); 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']);
// Ensure no database tables have been created yet.
$this->assertSame([], Database::getConnection()->schema()->findTables('%'));
$this->assertSession()->addressEquals($GLOBALS['base_url'] . '/core/install.php');
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -340,11 +340,12 @@ private function bootKernel() { ...@@ -340,11 +340,12 @@ private function bootKernel() {
// Bootstrap the kernel. Do not use createFromRequest() to retain Settings. // Bootstrap the kernel. Do not use createFromRequest() to retain Settings.
$kernel = new DrupalKernel('testing', $this->classLoader, FALSE); $kernel = new DrupalKernel('testing', $this->classLoader, FALSE);
$kernel->setSitePath($this->siteDirectory); $kernel->setSitePath($this->siteDirectory);
// Boot a new one-time container from scratch. Ensure to set the module list // Boot a new one-time container from scratch. Set the module list upfront
// upfront to avoid a subsequent rebuild. // to avoid a subsequent rebuild or setting the kernel into the
if ($modules && $extensions = $this->getExtensionsForModules($modules)) { // pre-installer mode.
$kernel->updateModules($extensions, $extensions); $extensions = $modules ? $this->getExtensionsForModules($modules) : [];
} $kernel->updateModules($extensions, $extensions);
// DrupalKernel::boot() is not sufficient as it does not invoke preHandle(), // DrupalKernel::boot() is not sufficient as it does not invoke preHandle(),
// which is required to initialize legacy global variables. // which is required to initialize legacy global variables.
$request = Request::create('/'); $request = Request::create('/');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment