diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index b6d5c63dd9f69574c90e0165462b919dc8cc14c1..55c9e7773ba0d58261cdb9cc4b3e19613db319d6 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -425,10 +425,9 @@ function install_begin_request($class_loader, &$install_state) { } $GLOBALS['conf']['container_service_providers']['InstallerConfigOverride'] = 'Drupal\Core\Installer\ConfigOverride'; - // Only allow dumping the container once the hash salt has been created. Note, - // InstallerKernel::createFromRequest() is not used because Settings is + // Note, InstallerKernel::createFromRequest() is not used because Settings is // already initialized. - $kernel = new InstallerKernel($environment, $class_loader, (bool) Settings::get('hash_salt', FALSE)); + $kernel = new InstallerKernel($environment, $class_loader, FALSE); $kernel::bootEnvironment(); $kernel->setSitePath($site_path); $kernel->boot(); diff --git a/core/lib/Drupal/Core/Installer/InstallerKernel.php b/core/lib/Drupal/Core/Installer/InstallerKernel.php index 501d1f27de45ec50d1910a48083a7d56f5febc97..8f4f1c760dee0882ad0cff4f29dd8a5c3fe5d9c8 100644 --- a/core/lib/Drupal/Core/Installer/InstallerKernel.php +++ b/core/lib/Drupal/Core/Installer/InstallerKernel.php @@ -15,6 +15,8 @@ class InstallerKernel extends DrupalKernel { protected function initializeContainer() { // Always force a container rebuild. $this->containerNeedsRebuild = TRUE; + // Ensure the InstallerKernel's container is not dumped. + $this->allowDumping = FALSE; $container = parent::initializeContainer(); return $container; } diff --git a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php index 2f86b8981fd58a14cc95a06c731db582e69b947d..a309858d9eb7f3de67b9c738bbbc9550af5ccea5 100644 --- a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php +++ b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php @@ -406,4 +406,12 @@ public static function trustedCallbacks() { return ['preRenderCacheTags']; } + /** + * Use a plain Symfony response object to output the current install_profile. + */ + public function getInstallProfile() { + $install_profile = \Drupal::installProfile() ?: 'NONE'; + return new Response('install_profile: ' . $install_profile); + } + } diff --git a/core/modules/system/tests/modules/system_test/system_test.routing.yml b/core/modules/system/tests/modules/system_test/system_test.routing.yml index b47174faacfc377bd7e41f52c9c159e3d1fc18e0..521e7b2376ae3b0b1d1185ca479a70f4ca82b1a4 100644 --- a/core/modules/system/tests/modules/system_test/system_test.routing.yml +++ b/core/modules/system/tests/modules/system_test/system_test.routing.yml @@ -204,3 +204,10 @@ system_test.custom_cache_control: _controller: '\Drupal\system_test\Controller\SystemTestController::getCacheableResponseWithCustomCacheControl' requirements: _access: 'TRUE' + +system_test.install_profile: + path: '/system-test/get-install-profile' + defaults: + _controller: '\Drupal\system_test\Controller\SystemTestController::getInstallProfile' + requirements: + _access: 'TRUE' diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5730ae9e3a0f4d07908a4d907700a49d3adf049a --- /dev/null +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php @@ -0,0 +1,40 @@ +<?php + +namespace Drupal\FunctionalTests\Installer; + +/** + * Tests re-visiting the installer after a successful installation. + * + * @group Installer + */ +class InstallerPostInstallTest extends InstallerTestBase { + + /** + * {@inheritdoc} + */ + protected $profile = 'minimal'; + + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'stark'; + + /** + * Confirms that visiting the installer does not break things post-install. + */ + public function testVisitInstallerPostInstall() { + \Drupal::service('module_installer')->install(['system_test']); + // Clear caches to ensure that system_test's routes are available. + $this->resetAll(); + // Confirm that the install_profile is correct. + $this->drupalGet('/system-test/get-install-profile'); + $this->assertText('minimal'); + // Make an anonymous visit to the installer + $this->drupalLogout(); + $this->visitInstaller(); + // Ensure that the install profile is still correct. + $this->drupalGet('/system-test/get-install-profile'); + $this->assertText('minimal'); + } + +}