@@ -58,8 +58,11 @@ protected function configure() {
5858 );
5959 }
6060
61+ /**
62+ * @throws \Exception
63+ */
6164 protected function execute (InputInterface $ input , OutputInterface $ output ): int {
62- if (!$ input ->isInteractive ()) {
65+ if (!$ input ->isInteractive () && ! $ input -> getOption ( ' no-interaction ' ) ) {
6366 $ output ->writeln ('Invalid TTY. ' );
6467 $ output ->writeln ('If you are trying to execute the command in a Docker ' );
6568 $ output ->writeln ("container, do not forget to execute 'docker exec' with " );
@@ -83,8 +86,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8386 $ output ->writeln ('Please ensure that no user accesses their files during this time! ' );
8487 $ output ->writeln ('Note: The encryption module you use determines which files get encrypted. ' );
8588 $ output ->writeln ('' );
86- $ question = new ConfirmationQuestion ('Do you really want to continue? (y/n) ' , false );
89+ $ question = new ConfirmationQuestion ('Do you really want to continue? (y/n) ' , true );
8790 if ($ this ->questionHelper ->ask ($ input , $ output , $ question )) {
91+ //run encryption with the answer yes in interactive mode
8892 $ this ->forceMaintenanceAndTrashbin ();
8993
9094 try {
@@ -98,6 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
98102 $ this ->resetMaintenanceAndTrashbin ();
99103 return self ::SUCCESS ;
100104 }
105+ //abort on no in interactive mode
101106 $ output ->writeln ('aborted ' );
102107 return self ::FAILURE ;
103108 }
0 commit comments