diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index ff571b1..01e3731 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -9,7 +9,6 @@ use Drupal\Core\DrupalKernel; use Drupal\Core\Database\Database; use Drupal\Core\Database\DatabaseExceptionWrapper; -use Drupal\Core\Extension\InfoParser; use Drupal\Core\Form\FormState; use Drupal\Core\Installer\Exception\AlreadyInstalledException; use Drupal\Core\Installer\Exception\InstallerException; @@ -1216,22 +1215,13 @@ function _install_select_profile(&$install_state) { return $profile; } } - // Check for a distribution. If the site has more than one distribution force - // the user to choose. - $listing = new ExtensionDiscovery(\Drupal::root()); - $listing->setProfileDirectories([]); - $info_parser = new InfoParser(); - $distributions = []; - foreach ($listing->scan('profile') as $profile) { - $info = $info_parser->parse($profile->getPathname()); - if (!empty($info['distribution'])) { - $distributions[] = $profile->getName(); + // Check for a distribution profile. + foreach ($install_state['profiles'] as $profile) { + $profile_info = install_profile_info($profile->getName()); + if (!empty($profile_info['distribution'])) { + return $profile->getName(); } } - // If there is only one distribution then use it. - if (count($distributions) === 1) { - return reset($distributions); - } // Get all visible (not hidden) profiles. $visible_profiles = array_filter($install_state['profiles'], function ($profile) { diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 92e5181..99f00d2 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -1512,15 +1512,16 @@ protected function addServiceFiles(array $service_yamls) { */ protected function getInstallProfile() { $config = $this->getConfigStorage()->read('core.extension'); - // Ensure empty strings are NULLs. - $install_profile = empty($config['profile']) ? NULL : $config['profile']; - - // If system_update_8300() has not yet run fallback to using settings. - if (empty($install_profile)) { + if (!empty($config['profile'])) { + $install_profile = $config['profile']; + } + else { + // If system_update_8300() has not yet run fallback to using settings. $install_profile = Settings::get('install_profile'); } - return $install_profile; + // Normalize an empty string to a NULL value. + return empty($install_profile) ? NULL : $install_profile; } } diff --git a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php index 5876eb7..472fdf9 100644 --- a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php +++ b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php @@ -323,13 +323,13 @@ function testNoThemeByDefault() { } /** - * Tests that \Drupal::installProfile() returns FALSE. + * Tests that \Drupal::installProfile() returns NULL. * * As the currently active installation profile is used when installing * configuration, for example, this is essential to ensure test isolation. */ public function testDrupalGetProfile() { - $this->assertFalse(\Drupal::installProfile()); + $this->assertNull(\Drupal::installProfile()); } /** diff --git a/core/modules/system/src/Tests/Installer/MultipleDistributionsProfileTest.php b/core/modules/system/src/Tests/Installer/MultipleDistributionsProfileTest.php index 0dab57f..171a0af 100644 --- a/core/modules/system/src/Tests/Installer/MultipleDistributionsProfileTest.php +++ b/core/modules/system/src/Tests/Installer/MultipleDistributionsProfileTest.php @@ -52,10 +52,12 @@ protected function setUp() { * {@inheritdoc} */ protected function setUpLanguage() { - $this->assertNoRaw('distribution_one'); - $this->assertNoRaw('distribution_two'); - // Verify that the "Choose profile" step appears. - $this->assertText('Choose profile'); + // Verify that the distribution name appears. + $this->assertRaw('distribution_one'); + // Verify that the requested theme is used. + $this->assertRaw('bartik'); + // Verify that the "Choose profile" step does not appear. + $this->assertNoText('profile'); parent::setUpLanguage(); } @@ -64,9 +66,7 @@ protected function setUpLanguage() { * {@inheritdoc} */ protected function setUpProfile() { - $this->assertText('distribution_one'); - $this->assertText('distribution_two'); - parent::setUpProfile(); + // This step is skipped, because there is a distribution profile. } /**