Skip to content

Commit

Permalink
[BUGFIX] Use fallback method to get dbname
Browse files Browse the repository at this point in the history
The fallback chain for determination of the
dbname in the SetupCommand is now using the
dedicated fallback method to gather values
from env -> cli option.

Resolves: #99374
Releases: main
Change-Id: Ic79552b44113659d41cd501bb8d5af7d67cfced6
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77162
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Torben Hansen <derhansen@gmail.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Torben Hansen <derhansen@gmail.com>
Tested-by: core-ci <typo3@b13.com>
  • Loading branch information
ochorocho authored and o-ba committed Dec 15, 2022
1 parent cfe6d10 commit 61fa870
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions typo3/sysext/install/Classes/Command/SetupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,14 @@ protected function selectAndImportDatabase(mixed $databaseConnection): int
return $dbname;
};

$dbname = $this->input->getOption('dbname') ?? getenv('TYPO3_SETUP_DBNAME');
if (!empty($dbname)) {
$dbNameValidator($dbname);
$databaseConnection['database'] = $dbname;
} else {
$dbnameFromCli = $this->getFallbackValueEnvOrOption('dbname', 'TYPO3_SETUP_DBNAME');
if ($dbnameFromCli === false && $this->input->isInteractive()) {
$dbname = new ChoiceQuestion('Select which database to use: ', $dbChoices);
$dbname->setValidator($dbNameValidator);
$databaseConnection['database'] = $this->questionHelper->ask($this->input, $this->output, $dbname);
} else {
$dbNameValidator($dbnameFromCli);
$databaseConnection['database'] = $dbnameFromCli;
}

$checkDatabase = $this->setupDatabaseService->checkExistingDatabase($databaseConnection['database']);
Expand Down

0 comments on commit 61fa870

Please sign in to comment.