Skip to content

Commit

Permalink
Trust existing config to have a profile set correctly (#5925)
Browse files Browse the repository at this point in the history
* Trust existing config to have a profile set correctly - also allow sites with no profile to be installed from config

* PHPCS

* Add return type hint

---------

Co-authored-by: Moshe Weitzman <weitzman@tejasa.com>
  • Loading branch information
alexpott and weitzman committed Mar 30, 2024
1 parent 8aa7750 commit d0398e7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Commands/core/SiteInstallCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function taskCallback($install_state): void
}


protected function determineProfile($profile, $options)
protected function determineProfile($profile, $options): string|bool
{
// Try to get profile from existing config if not provided as an argument.
// @todo Arguably Drupal core [$boot->getKernel()->getInstallProfile()] could do this - https://github.com/drupal/drupal/blob/8.6.x/core/lib/Drupal/Core/DrupalKernel.php#L1606 reads from DB storage but not file storage.
Expand All @@ -195,7 +195,8 @@ protected function determineProfile($profile, $options)
throw new \Exception(dt('Existing configuration directory @config does not contain a core.extension.yml file.', ['@config' => $config_directory]));
}
$config = $source_storage->read('core.extension');
$profile = $config['profile'];
$profile = $config['profile'] ?? false;
return $profile;
}

if (empty($profile)) {
Expand Down

0 comments on commit d0398e7

Please sign in to comment.