@@ -90,25 +90,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9090 $ question = new ConfirmationQuestion ('Do you really want to continue? (y/n) ' , true );
9191 if ($ this ->questionHelper ->ask ($ input , $ output , $ question )) {
9292 //run encryption with the answer yes in interactive mode
93- return $ this ->runEncryption ($ input , $ output );
94- }
95- //abort on no in interactive mode
96- $ output ->writeln ('aborted ' );
97- return self ::FAILURE ;
98- }
93+ $ this ->forceMaintenanceAndTrashbin ();
9994
100- private function runEncryption (InputInterface $ input , OutputInterface $ output ): int {
101- $ this ->forceMaintenanceAndTrashbin ();
95+ try {
96+ $ defaultModule = $ this ->encryptionManager ->getEncryptionModule ();
97+ $ defaultModule ->encryptAll ($ input , $ output );
98+ } catch (\Exception $ ex ) {
99+ $ this ->resetMaintenanceAndTrashbin ();
100+ throw $ ex ;
101+ }
102102
103- try {
104- $ defaultModule = $ this ->encryptionManager ->getEncryptionModule ();
105- $ defaultModule ->encryptAll ($ input , $ output );
106- } catch (\Exception $ ex ) {
107103 $ this ->resetMaintenanceAndTrashbin ();
108- throw $ ex ;
104+ return self :: SUCCESS ;
109105 }
110-
111- $ this -> resetMaintenanceAndTrashbin ( );
112- return self ::SUCCESS ;
106+ //abort on no in interactive mode
107+ $ output -> writeln ( ' aborted ' );
108+ return self ::FAILURE ;
113109 }
114110}
0 commit comments