diff options
Diffstat (limited to 'core/Command/Encryption/DecryptAll.php')
-rw-r--r-- | core/Command/Encryption/DecryptAll.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/core/Command/Encryption/DecryptAll.php b/core/Command/Encryption/DecryptAll.php index 4d7b4028396..7382c254723 100644 --- a/core/Command/Encryption/DecryptAll.php +++ b/core/Command/Encryption/DecryptAll.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Björn Schießle <bjoern@schiessle.org> + * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @author davitol <dtoledo@solidgear.es> * @author Evgeny Golyshev <eugulixes@gmail.com> * @author Joas Schilling <coding@schilljs.com> @@ -10,7 +11,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Ruben Homs <ruben@homs.codes> * @author Sergio Bertolín <sbertolin@solidgear.es> - * @author Vincent Petry <pvince81@owncloud.com> + * @author Vincent Petry <vincent@nextcloud.com> * * @license AGPL-3.0 * @@ -27,7 +28,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ - namespace OC\Core\Command\Encryption; use OCP\App\IAppManager; @@ -124,14 +124,14 @@ class DecryptAll extends Command { ); } - protected function execute(InputInterface $input, OutputInterface $output) { - if ( !$input->isInteractive() ) { + protected function execute(InputInterface $input, OutputInterface $output): int { + if (!$input->isInteractive()) { $output->writeln('Invalid TTY.'); $output->writeln('If you are trying to execute the command in a Docker '); $output->writeln("container, do not forget to execute 'docker exec' with"); $output->writeln("the '-i' and '-t' options."); $output->writeln(''); - return; + return 1; } $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); @@ -140,7 +140,7 @@ class DecryptAll extends Command { $output->writeln("in order to load the relevant encryption modules correctly."); $output->writeln("Your instance will automatically be put to maintenance mode"); $output->writeln("during the actual decryption of the files."); - return; + return 1; } try { @@ -150,7 +150,7 @@ class DecryptAll extends Command { $output->writeln('done.'); } else { $output->writeln('Server side encryption not enabled. Nothing to do.'); - return; + return 0; } $uid = $input->getArgument('user'); @@ -175,16 +175,18 @@ class DecryptAll extends Command { $output->writeln(' aborted.'); $output->writeln('Server side encryption remains enabled'); $this->config->setAppValue('core', 'encryption_enabled', 'yes'); - } else if ($uid !== '') { + } elseif ($uid !== '') { $output->writeln('Server side encryption remains enabled'); $this->config->setAppValue('core', 'encryption_enabled', 'yes'); } $this->resetMaintenanceAndTrashbin(); + return 0; } else { $output->write('Enable server side encryption... '); $this->config->setAppValue('core', 'encryption_enabled', 'yes'); $output->writeln('done.'); $output->writeln('aborted'); + return 1; } } catch (\Exception $e) { // enable server side encryption again if something went wrong @@ -192,6 +194,5 @@ class DecryptAll extends Command { $this->resetMaintenanceAndTrashbin(); throw $e; } - } } |