Skip to content

Commit 2e742ec

Browse files
committed
WIP: BUG#AC-901: Cant install Magento in interactive mode
1 parent 5f76c92 commit 2e742ec

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

app/code/Magento/Config/Setup/ConfigOptionsList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ public function getOptions()
6161
new SelectConfigOption(
6262
self::INPUT_KEY_DEBUG_LOGGING,
6363
SelectConfigOption::FRONTEND_WIZARD_RADIO,
64-
[true, false, 1, 0],
64+
['true', 'false', 1, 0],
6565
self::CONFIG_PATH_DEBUG_LOGGING,
6666
'Enable debug logging'
6767
),
6868
new SelectConfigOption(
6969
self::INPUT_KEY_SYSLOG_LOGGING,
7070
SelectConfigOption::FRONTEND_WIZARD_RADIO,
71-
[true, false, 1, 0],
71+
['true', 'false', 1, 0],
7272
self::CONFIG_PATH_SYSLOG_LOGGING,
7373
'Enable syslog logging'
7474
),

setup/src/Magento/Setup/Console/Command/InstallCommand.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ class InstallCommand extends AbstractSetupCommand
116116
*/
117117
protected $searchConfigOptionsList;
118118

119+
/**
120+
* @var array
121+
*/
122+
protected $interactiveSetupUserInput;
123+
119124
/**
120125
* Constructor
121126
*
@@ -228,7 +233,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
228233
{
229234
$consoleLogger = new ConsoleLogger($output);
230235
$installer = $this->installerFactory->create($consoleLogger);
231-
$installer->install($input->getOptions());
236+
$isInteractiveSetup = $input->getOption(self::INPUT_KEY_INTERACTIVE_SETUP) ?? false;
237+
$installer->install($isInteractiveSetup ? $this->interactiveSetupUserInput : $input->getOptions());
232238

233239
$importConfigCommand = $this->getApplication()->find(ConfigImportCommand::COMMAND_NAME);
234240
$arrayInput = new ArrayInput([]);
@@ -260,6 +266,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
260266
$command .= " --{$key}={$value}";
261267
}
262268
$output->writeln("<comment>Try re-running command: php bin/magento setup:install{$command}</comment>");
269+
$this->interactiveSetupUserInput = $configOptionsToValidate;
263270
}
264271

265272
$errors = $this->configModel->validate($configOptionsToValidate);
@@ -409,7 +416,7 @@ private function askQuestion(
409416
if ($answer == null) {
410417
$answer = '';
411418
} else {
412-
$answer = trim($answer);
419+
$answer = is_string($answer) ? trim($answer) : $answer;
413420
}
414421

415422
if ($validateInline) {

setup/src/Magento/Setup/Model/ConfigModel.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,12 @@ public function validate(array $inputOptions)
134134
$options = $this->getAvailableOptions();
135135
foreach ($options as $option) {
136136
try {
137-
if ($inputOptions[$option->getName()] !== null) {
138-
$option->validate($inputOptions[$option->getName()]);
137+
$inputValue = $inputOptions[$option->getName()] ?? null;
138+
139+
if ($inputValue !== null) {
140+
$option->validate($inputValue);
139141
}
142+
140143
} catch (\InvalidArgumentException $e) {
141144
$errors[] = $e->getMessage();
142145
}

setup/src/Magento/Setup/Model/ConfigOptionsList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function validate(array $options, DeploymentConfig $deploymentConfig)
252252
$errors[] = $this->validateDbPrefix($options[ConfigOptionsListConstants::INPUT_KEY_DB_PREFIX]);
253253
}
254254

255-
if (!$options[ConfigOptionsListConstants::INPUT_KEY_SKIP_DB_VALIDATION]) {
255+
if ($options[ConfigOptionsListConstants::INPUT_KEY_SKIP_DB_VALIDATION] ?? false) {
256256
$errors[] = $this->validateDbSettings($options, $deploymentConfig);
257257
}
258258

0 commit comments

Comments
 (0)