Introduce new variable with the default answer to allow option --no-interaction for command occ db:convert-type

Variable is set to true for --no-interaction and false otherwise

Signed-off-by: Bernhard Ostertag <bernieo.code@gmx.de>
This commit is contained in:
Bernhard Ostertag 2019-12-29 11:03:51 +01:00
parent fe0e47bf5e
commit 6a017eb205
No known key found for this signature in database
GPG Key ID: 7D99DC27B1B6030E
1 changed files with 7 additions and 7 deletions

View File

@ -212,16 +212,16 @@ class ConvertType extends Command implements CompletionAwareInterface {
$output->writeln('<comment>can be included by specifying the --all-apps option.</comment>'); $output->writeln('<comment>can be included by specifying the --all-apps option.</comment>');
} }
if ($input->isInteractive()) { $continueConversion = !$input->isInteractive(); // assume yes for --no-interaction and no otherwise.
$question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', $continueConversion);
/** @var QuestionHelper $helper */ /** @var QuestionHelper $helper */
$helper = $this->getHelper('question'); $helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false);
if (!$helper->ask($input, $output, $question)) { if (!$helper->ask($input, $output, $question)) {
return; return;
} }
} }
}
$intersectingTables = array_intersect($toTables, $fromTables); $intersectingTables = array_intersect($toTables, $fromTables);
$this->convertDB($fromDB, $toDB, $intersectingTables, $input, $output); $this->convertDB($fromDB, $toDB, $intersectingTables, $input, $output);
} }