diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 890af7a563..c9ca648e3c 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -424,8 +424,11 @@ 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. - $kernel = InstallerKernel::createFromRequest($request, $class_loader, $environment, (bool) Settings::get('hash_salt', FALSE)); + // Only allow dumping the container once the hash salt has been created. Note, + // InstallerKernel::createFromRequest() is not used because Settings is + // already initialized. + $kernel = new InstallerKernel($environment, $class_loader, (bool) Settings::get('hash_salt', FALSE)); + $kernel::bootEnvironment(); $kernel->setSitePath($site_path); $kernel->boot(); $container = $kernel->getContainer(); diff --git a/core/lib/Drupal/Core/Installer/InstallerKernel.php b/core/lib/Drupal/Core/Installer/InstallerKernel.php index 45708424d7..adeb5c53ee 100644 --- a/core/lib/Drupal/Core/Installer/InstallerKernel.php +++ b/core/lib/Drupal/Core/Installer/InstallerKernel.php @@ -3,8 +3,6 @@ namespace Drupal\Core\Installer; use Drupal\Core\DrupalKernel; -use Drupal\Core\Site\Settings; -use Symfony\Component\HttpFoundation\Request; /** * Extend DrupalKernel to handle force some kernel behaviors. @@ -68,21 +66,4 @@ public function getInstallProfile() { return $profile; } - /** - * {@inheritdoc} - */ - public static function createFromRequest(Request $request, $class_loader, $environment, $allow_dumping = TRUE, $app_root = NULL) { - $kernel = new static($environment, $class_loader, $allow_dumping, $app_root); - static::bootEnvironment($app_root); - // Don't initialize settings again if they already have been. This can occur - // in install_begin_request(). - try { - Settings::getInstance(); - } - catch (\BadMethodCallException $e) { - $kernel->initializeSettings($request); - } - return $kernel; - } - } diff --git a/core/tests/Drupal/Tests/Core/Installer/InstallerKernelTest.php b/core/tests/Drupal/Tests/Core/Installer/InstallerKernelTest.php deleted file mode 100644 index 56be6c85bf..0000000000 --- a/core/tests/Drupal/Tests/Core/Installer/InstallerKernelTest.php +++ /dev/null @@ -1,54 +0,0 @@ - 'bar']); - $request = Request::createFromGlobals(); - $classloader = $this->prophesize(ClassLoader::class)->reveal(); - InstallerKernel::createFromRequest($request, $classloader, 'test', FALSE, NULL); - $this->assertEquals('bar', Settings::get('foo')); - } - - /** - * Tests that createFromRequest initializes Settings if necessary. - * - * @covers ::createFromRequest - */ - public function testCreateFromRequestNoSettings() { - $exception_thrown = FALSE; - try { - Settings::getInstance(); - } - catch (\BadMethodCallException $e) { - $exception_thrown = TRUE; - } - $this->assertTrue($exception_thrown); - $request = Request::createFromGlobals(); - $classloader = $this->prophesize(ClassLoader::class)->reveal(); - InstallerKernel::createFromRequest($request, $classloader, 'test', FALSE, NULL); - $this->assertInstanceOf(Settings::class, Settings::getInstance()); - } - -}