From 6a017eb205c6c37d01d76495e2084f5e1ff4fd17 Mon Sep 17 00:00:00 2001 From: Bernhard Ostertag Date: Sun, 29 Dec 2019 11:03:51 +0100 Subject: 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 --- core/Command/Db/ConvertType.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'core/Command') diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index 8b6f2b10c75..3c5d62aa4bd 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -212,14 +212,14 @@ class ConvertType extends Command implements CompletionAwareInterface { $output->writeln('can be included by specifying the --all-apps option.'); } - if ($input->isInteractive()) { - /** @var QuestionHelper $helper */ - $helper = $this->getHelper('question'); - $question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false); + $continueConversion = !$input->isInteractive(); // assume yes for --no-interaction and no otherwise. + $question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', $continueConversion); - if (!$helper->ask($input, $output, $question)) { - return; - } + /** @var QuestionHelper $helper */ + $helper = $this->getHelper('question'); + + if (!$helper->ask($input, $output, $question)) { + return; } } $intersectingTables = array_intersect($toTables, $fromTables); -- cgit v1.2.3