@@ -56,18 +56,22 @@ protected function configure() {
5656 $ this ->setHelp (
5757 'This will encrypt all files for all users. '
5858 . 'Please make sure that no user access his files during this process! '
59- )->addOption (
60- 'no-interaction ' ,
61- 'n ' ,
62- InputOption::VALUE_NONE ,
63- 'Do not ask any interactive question '
6459 );
6560 }
6661
6762 /**
6863 * @throws \Exception
6964 */
7065 protected function execute (InputInterface $ input , OutputInterface $ output ): int {
66+ if (!$ input ->isInteractive () && !$ input ->getOption ('no-interaction ' )) {
67+ $ output ->writeln ('Invalid TTY. ' );
68+ $ output ->writeln ('If you are trying to execute the command in a Docker ' );
69+ $ output ->writeln ("container, do not forget to execute 'docker exec' with " );
70+ $ output ->writeln ("the '-i' and '-t' options. " );
71+ $ output ->writeln ('' );
72+ return 1 ;
73+ }
74+
7175 if ($ this ->encryptionManager ->isEnabled () === false ) {
7276 throw new \Exception ('Server side encryption is not enabled ' );
7377 }
@@ -83,14 +87,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8387 $ output ->writeln ('Please ensure that no user accesses their files during this time! ' );
8488 $ output ->writeln ('Note: The encryption module you use determines which files get encrypted. ' );
8589 $ output ->writeln ('' );
86- $ isNoInteraction = $ input ->getOption ('no-interaction ' );
87- $ question = new ConfirmationQuestion ('Do you really want to continue? (y/n) ' , false );
88- if ($ input ->isInteractive () && $ this ->questionHelper ->ask ($ input , $ output , $ question )) {
90+ $ question = new ConfirmationQuestion ('Do you really want to continue? (y/n) ' , true );
91+ if ($ this ->questionHelper ->ask ($ input , $ output , $ question )) {
8992 //run encryption with the answer yes in interactive mode
9093 return $ this ->runEncryption ($ input , $ output );
91- } elseif (!$ input ->isInteractive () && $ isNoInteraction ) {
92- //run encryption without the question in non-interactive mode if -n option is available
93- return $ this ->runEncryption ($ input , $ output );
9494 }
9595 //abort on no in interactive mode
9696 $ output ->writeln ('aborted ' );
0 commit comments