aboutsummaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-06-26 15:12:11 +0200
committerJoas Schilling <coding@schilljs.com>2020-06-26 15:12:11 +0200
commitd7c0b9cced2dff16e4e05507ac58cf8664a6aafc (patch)
treebb136f0e797986da6e789bf2bf5e9f0370002d26 /apps/encryption/lib
parentab21d69903c4360cbce59741624b6e765e3bd35f (diff)
downloadnextcloud-server-d7c0b9cced2dff16e4e05507ac58cf8664a6aafc.tar.gz
nextcloud-server-d7c0b9cced2dff16e4e05507ac58cf8664a6aafc.zip
Also always return in app commands
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r--apps/encryption/lib/Command/DisableMasterKey.php4
-rw-r--r--apps/encryption/lib/Command/EnableMasterKey.php4
-rw-r--r--apps/encryption/lib/Command/RecoverUser.php9
3 files changed, 11 insertions, 6 deletions
diff --git a/apps/encryption/lib/Command/DisableMasterKey.php b/apps/encryption/lib/Command/DisableMasterKey.php
index 319286bc926..fa0572c5fb8 100644
--- a/apps/encryption/lib/Command/DisableMasterKey.php
+++ b/apps/encryption/lib/Command/DisableMasterKey.php
@@ -63,7 +63,7 @@ class DisableMasterKey extends Command {
->setDescription('Disable the master key and use per-user keys instead. Only available for fresh installations with no existing encrypted data! There is no way to enable it again.');
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$isMasterKeyEnabled = $this->util->isMasterKeyEnabled();
if (!$isMasterKeyEnabled) {
@@ -80,7 +80,9 @@ class DisableMasterKey extends Command {
$output->writeln('Master key successfully disabled.');
} else {
$output->writeln('aborted.');
+ return 1;
}
}
+ return 0;
}
}
diff --git a/apps/encryption/lib/Command/EnableMasterKey.php b/apps/encryption/lib/Command/EnableMasterKey.php
index 4b1a5219c11..b1e7319384a 100644
--- a/apps/encryption/lib/Command/EnableMasterKey.php
+++ b/apps/encryption/lib/Command/EnableMasterKey.php
@@ -62,7 +62,7 @@ class EnableMasterKey extends Command {
->setDescription('Enable the master key. Only available for fresh installations with no existing encrypted data! There is also no way to disable it again.');
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$isAlreadyEnabled = $this->util->isMasterKeyEnabled();
if ($isAlreadyEnabled) {
@@ -76,7 +76,9 @@ class EnableMasterKey extends Command {
$output->writeln('Master key successfully enabled.');
} else {
$output->writeln('aborted.');
+ return 1;
}
}
+ return 0;
}
}
diff --git a/apps/encryption/lib/Command/RecoverUser.php b/apps/encryption/lib/Command/RecoverUser.php
index fd702bc0313..642182dbf59 100644
--- a/apps/encryption/lib/Command/RecoverUser.php
+++ b/apps/encryption/lib/Command/RecoverUser.php
@@ -73,25 +73,25 @@ class RecoverUser extends Command {
);
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$isMasterKeyEnabled = $this->util->isMasterKeyEnabled();
if ($isMasterKeyEnabled) {
$output->writeln('You use the master key, no individual user recovery needed.');
- return;
+ return 0;
}
$uid = $input->getArgument('user');
$userExists = $this->userManager->userExists($uid);
if ($userExists === false) {
$output->writeln('User "' . $uid . '" unknown.');
- return;
+ return 1;
}
$recoveryKeyEnabled = $this->util->isRecoveryEnabledForUser($uid);
if ($recoveryKeyEnabled === false) {
$output->writeln('Recovery key is not enabled for: ' . $uid);
- return;
+ return 1;
}
$question = new Question('Please enter the recovery key password: ');
@@ -107,5 +107,6 @@ class RecoverUser extends Command {
$output->write('Start to recover users files... This can take some time...');
$this->userManager->get($uid)->setPassword($newLoginPassword, $recoveryPassword);
$output->writeln('Done.');
+ return 0;
}
}