From fe0e47bf5e80a284f1fe97513d6060550f1eeda8 Mon Sep 17 00:00:00 2001 From: Bernhard Ostertag Date: Fri, 27 Dec 2019 07:50:30 +0100 Subject: [PATCH 1/2] enable option '--no-interaction' for db:convert-type Signed-off-by: Bernhard Ostertag --- core/Command/Db/ConvertType.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index 37f94f9be7..8b6f2b10c7 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -212,12 +212,14 @@ class ConvertType extends Command implements CompletionAwareInterface { $output->writeln('can be included by specifying the --all-apps option.'); } - /** @var QuestionHelper $helper */ - $helper = $this->getHelper('question'); - $question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false); + if ($input->isInteractive()) { + /** @var QuestionHelper $helper */ + $helper = $this->getHelper('question'); + $question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false); - if (!$helper->ask($input, $output, $question)) { - return; + if (!$helper->ask($input, $output, $question)) { + return; + } } } $intersectingTables = array_intersect($toTables, $fromTables); From 6a017eb205c6c37d01d76495e2084f5e1ff4fd17 Mon Sep 17 00:00:00 2001 From: Bernhard Ostertag Date: Sun, 29 Dec 2019 11:03:51 +0100 Subject: [PATCH 2/2] 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(-) diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index 8b6f2b10c7..3c5d62aa4b 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);