Skip to content

Commit c4a196c

Browse files
mdeboerbocharsky-bw
authored andcommitted
Fix delete obsolete translations command on non-interactive cli (#303)
Fixes the translationdelete-obsolete command not running in non-interactive shells. The question was simply never asked, not even when 'yes'. This fix will run the command (assume yes) on non-interactive shells which allows you to run the command in scripts (e.g. update a lot of translations).
1 parent 62d0029 commit c4a196c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Command/DeleteObsoleteCommand.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
100100
return;
101101
}
102102

103-
$helper = $this->getHelper('question');
104-
$question = new ConfirmationQuestion(sprintf('You are about to remove %d translations. Do you wish to continue? (y/N) ', $messageCount), false);
105-
if (!$helper->ask($input, $output, $question)) {
106-
return;
103+
if ($input->isInteractive()) {
104+
$helper = $this->getHelper('question');
105+
$question = new ConfirmationQuestion(sprintf('You are about to remove %d translations. Do you wish to continue? (y/N) ', $messageCount), false);
106+
if (!$helper->ask($input, $output, $question)) {
107+
return;
108+
}
107109
}
108110

109111
$progress = null;

0 commit comments

Comments
 (0)