aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--apps/dav/lib/Command/CreateAddressBook.php3
-rw-r--r--apps/dav/lib/Command/CreateCalendar.php3
-rw-r--r--apps/dav/lib/Command/ListCalendars.php3
-rw-r--r--apps/dav/lib/Command/MoveCalendar.php3
-rw-r--r--apps/dav/lib/Command/RemoveInvalidShares.php3
-rw-r--r--apps/dav/lib/Command/SendEventReminders.php7
-rw-r--r--apps/dav/lib/Command/SyncBirthdayCalendar.php5
-rw-r--r--apps/dav/lib/Command/SyncSystemAddressBook.php3
-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
-rw-r--r--apps/federation/lib/Command/SyncFederationAddressBooks.php2
-rw-r--r--apps/files/lib/Command/DeleteOrphanedFiles.php3
-rw-r--r--apps/files/lib/Command/Scan.php5
-rw-r--r--apps/files/lib/Command/ScanAppData.php2
-rw-r--r--apps/files/lib/Command/TransferOwnership.php2
-rw-r--r--apps/files_external/lib/Command/Applicable.php3
-rw-r--r--apps/files_external/lib/Command/Backends.php3
-rw-r--r--apps/files_external/lib/Command/Config.php3
-rw-r--r--apps/files_external/lib/Command/Create.php2
-rw-r--r--apps/files_external/lib/Command/Delete.php5
-rw-r--r--apps/files_external/lib/Command/Export.php3
-rw-r--r--apps/files_external/lib/Command/Import.php2
-rw-r--r--apps/files_external/lib/Command/ListCommand.php3
-rw-r--r--apps/files_external/lib/Command/Notify.php3
-rw-r--r--apps/files_external/lib/Command/Verify.php3
-rw-r--r--apps/files_sharing/lib/Command/CleanupRemoteStorages.php3
-rw-r--r--apps/files_sharing/lib/Command/ExiprationNotification.php3
-rw-r--r--apps/files_trashbin/lib/Command/CleanUp.php4
-rw-r--r--apps/files_trashbin/lib/Command/ExpireTrash.php8
-rw-r--r--apps/files_versions/lib/Command/CleanUp.php4
-rw-r--r--apps/files_versions/lib/Command/ExpireVersions.php6
-rw-r--r--apps/updatenotification/lib/Command/Check.php2
-rw-r--r--apps/user_ldap/lib/Command/CheckUser.php6
-rw-r--r--apps/user_ldap/lib/Command/CreateEmptyConfig.php3
-rw-r--r--apps/user_ldap/lib/Command/DeleteConfig.php4
-rw-r--r--apps/user_ldap/lib/Command/Search.php3
-rw-r--r--apps/user_ldap/lib/Command/SetConfig.php5
-rw-r--r--apps/user_ldap/lib/Command/ShowConfig.php5
-rw-r--r--apps/user_ldap/lib/Command/ShowRemnants.php3
-rw-r--r--apps/user_ldap/lib/Command/TestConfig.php6
-rw-r--r--apps/workflowengine/lib/Command/Index.php3
42 files changed, 102 insertions, 57 deletions
diff --git a/apps/dav/lib/Command/CreateAddressBook.php b/apps/dav/lib/Command/CreateAddressBook.php
index 317b356772e..6bd175f91d3 100644
--- a/apps/dav/lib/Command/CreateAddressBook.php
+++ b/apps/dav/lib/Command/CreateAddressBook.php
@@ -64,7 +64,7 @@ class CreateAddressBook extends Command {
'Name of the addressbook');
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$user = $input->getArgument('user');
if (!$this->userManager->userExists($user)) {
throw new \InvalidArgumentException("User <$user> in unknown.");
@@ -72,5 +72,6 @@ class CreateAddressBook extends Command {
$name = $input->getArgument('name');
$this->cardDavBackend->createAddressBook("principals/users/$user", $name, []);
+ return 0;
}
}
diff --git a/apps/dav/lib/Command/CreateCalendar.php b/apps/dav/lib/Command/CreateCalendar.php
index 81a8773957a..d03b573e4ab 100644
--- a/apps/dav/lib/Command/CreateCalendar.php
+++ b/apps/dav/lib/Command/CreateCalendar.php
@@ -73,7 +73,7 @@ class CreateCalendar extends Command {
'Name of the calendar');
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$user = $input->getArgument('user');
if (!$this->userManager->userExists($user)) {
throw new \InvalidArgumentException("User <$user> in unknown.");
@@ -94,5 +94,6 @@ class CreateCalendar extends Command {
$name = $input->getArgument('name');
$caldav = new CalDavBackend($this->dbConnection, $principalBackend, $this->userManager, $this->groupManager, $random, $logger, $dispatcher);
$caldav->createCalendar("principals/users/$user", $name, []);
+ return 0;
}
}
diff --git a/apps/dav/lib/Command/ListCalendars.php b/apps/dav/lib/Command/ListCalendars.php
index 85aa25be946..422202d9227 100644
--- a/apps/dav/lib/Command/ListCalendars.php
+++ b/apps/dav/lib/Command/ListCalendars.php
@@ -62,7 +62,7 @@ class ListCalendars extends Command {
'User for whom all calendars will be listed');
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$user = $input->getArgument('uid');
if (!$this->userManager->userExists($user)) {
throw new \InvalidArgumentException("User <$user> is unknown.");
@@ -101,5 +101,6 @@ class ListCalendars extends Command {
} else {
$output->writeln("<info>User <$user> has no calendars</info>");
}
+ return 0;
}
}
diff --git a/apps/dav/lib/Command/MoveCalendar.php b/apps/dav/lib/Command/MoveCalendar.php
index d40f4600745..b89c64d7ba7 100644
--- a/apps/dav/lib/Command/MoveCalendar.php
+++ b/apps/dav/lib/Command/MoveCalendar.php
@@ -106,7 +106,7 @@ class MoveCalendar extends Command {
->addOption('force', 'f', InputOption::VALUE_NONE, "Force the migration by removing existing shares");
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$userOrigin = $input->getArgument('sourceuid');
$userDestination = $input->getArgument('destinationuid');
@@ -137,6 +137,7 @@ class MoveCalendar extends Command {
$this->calDav->moveCalendar($name, self::URI_USERS . $userOrigin, self::URI_USERS . $userDestination);
$this->io->success("Calendar <$name> was moved from user <$userOrigin> to <$userDestination>");
+ return 0;
}
/**
diff --git a/apps/dav/lib/Command/RemoveInvalidShares.php b/apps/dav/lib/Command/RemoveInvalidShares.php
index 71644456f67..0129191c18b 100644
--- a/apps/dav/lib/Command/RemoveInvalidShares.php
+++ b/apps/dav/lib/Command/RemoveInvalidShares.php
@@ -57,7 +57,7 @@ class RemoveInvalidShares extends Command {
->setDescription('Remove invalid dav shares');
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$query = $this->connection->getQueryBuilder();
$result = $query->selectDistinct('principaluri')
->from('dav_shares')
@@ -72,6 +72,7 @@ class RemoveInvalidShares extends Command {
}
$result->closeCursor();
+ return 0;
}
/**
diff --git a/apps/dav/lib/Command/SendEventReminders.php b/apps/dav/lib/Command/SendEventReminders.php
index 8313f265bfc..3eb7f1a56ee 100644
--- a/apps/dav/lib/Command/SendEventReminders.php
+++ b/apps/dav/lib/Command/SendEventReminders.php
@@ -67,19 +67,20 @@ class SendEventReminders extends Command {
* @param InputInterface $input
* @param OutputInterface $output
*/
- protected function execute(InputInterface $input, OutputInterface $output):void {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') {
$output->writeln('<error>Sending event reminders disabled!</error>');
$output->writeln('<info>Please run "php occ config:app:set dav sendEventReminders --value yes"');
- return;
+ return 1;
}
if ($this->config->getAppValue('dav', 'sendEventRemindersMode', 'backgroundjob') !== 'occ') {
$output->writeln('<error>Sending event reminders mode set to background-job!</error>');
$output->writeln('<info>Please run "php occ config:app:set dav sendEventRemindersMode --value occ"');
- return;
+ return 1;
}
$this->reminderService->processReminders();
+ return 0;
}
}
diff --git a/apps/dav/lib/Command/SyncBirthdayCalendar.php b/apps/dav/lib/Command/SyncBirthdayCalendar.php
index 0addbc08a73..6536f8439a4 100644
--- a/apps/dav/lib/Command/SyncBirthdayCalendar.php
+++ b/apps/dav/lib/Command/SyncBirthdayCalendar.php
@@ -73,7 +73,7 @@ class SyncBirthdayCalendar extends Command {
* @param InputInterface $input
* @param OutputInterface $output
*/
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$this->verifyEnabled();
$user = $input->getArgument('user');
@@ -91,7 +91,7 @@ class SyncBirthdayCalendar extends Command {
$output->writeln("Start birthday calendar sync for $user");
$this->birthdayService->syncUser($user);
- return;
+ return 0;
}
$output->writeln("Start birthday calendar sync for all users ...");
$p = new ProgressBar($output);
@@ -111,6 +111,7 @@ class SyncBirthdayCalendar extends Command {
$p->finish();
$output->writeln('');
+ return 0;
}
protected function verifyEnabled() {
diff --git a/apps/dav/lib/Command/SyncSystemAddressBook.php b/apps/dav/lib/Command/SyncSystemAddressBook.php
index 26cb0aa6439..9fabc6de883 100644
--- a/apps/dav/lib/Command/SyncSystemAddressBook.php
+++ b/apps/dav/lib/Command/SyncSystemAddressBook.php
@@ -53,7 +53,7 @@ class SyncSystemAddressBook extends Command {
* @param InputInterface $input
* @param OutputInterface $output
*/
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$output->writeln('Syncing users ...');
$progress = new ProgressBar($output);
$progress->start();
@@ -63,5 +63,6 @@ class SyncSystemAddressBook extends Command {
$progress->finish();
$output->writeln('');
+ return 0;
}
}
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;
}
}
diff --git a/apps/federation/lib/Command/SyncFederationAddressBooks.php b/apps/federation/lib/Command/SyncFederationAddressBooks.php
index 48f8895c1d7..05c24bdcb81 100644
--- a/apps/federation/lib/Command/SyncFederationAddressBooks.php
+++ b/apps/federation/lib/Command/SyncFederationAddressBooks.php
@@ -56,7 +56,7 @@ class SyncFederationAddressBooks extends Command {
* @param OutputInterface $output
* @return int
*/
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$progress = new ProgressBar($output);
$progress->start();
$this->syncService->syncThemAll(function ($url, $ex) use ($progress, $output) {
diff --git a/apps/files/lib/Command/DeleteOrphanedFiles.php b/apps/files/lib/Command/DeleteOrphanedFiles.php
index 167d679e3c8..c8ce9729ef7 100644
--- a/apps/files/lib/Command/DeleteOrphanedFiles.php
+++ b/apps/files/lib/Command/DeleteOrphanedFiles.php
@@ -51,7 +51,7 @@ class DeleteOrphanedFiles extends Command {
->setDescription('cleanup filecache');
}
- public function execute(InputInterface $input, OutputInterface $output) {
+ public function execute(InputInterface $input, OutputInterface $output): int {
$deletedEntries = 0;
$query = $this->connection->getQueryBuilder();
@@ -78,5 +78,6 @@ class DeleteOrphanedFiles extends Command {
}
$output->writeln("$deletedEntries orphaned file cache entries deleted");
+ return 0;
}
}
diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php
index c75073e428f..aea6003417d 100644
--- a/apps/files/lib/Command/Scan.php
+++ b/apps/files/lib/Command/Scan.php
@@ -169,7 +169,7 @@ class Scan extends Base {
return substr_count($mountPoint->getMountPoint(), '/') <= 3;
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$inputPath = $input->getOption('path');
if ($inputPath) {
$inputPath = '/' . trim($inputPath, '/');
@@ -190,7 +190,7 @@ class Scan extends Base {
$users_total = count($users);
if ($users_total === 0) {
$output->writeln('<error>Please specify the user id to scan, --all to scan for all users or --path=...</error>');
- return;
+ return 1;
}
$this->initTools();
@@ -219,6 +219,7 @@ class Scan extends Base {
}
$this->presentStats($output);
+ return 0;
}
/**
diff --git a/apps/files/lib/Command/ScanAppData.php b/apps/files/lib/Command/ScanAppData.php
index 47cd81e6b4e..47a153d3895 100644
--- a/apps/files/lib/Command/ScanAppData.php
+++ b/apps/files/lib/Command/ScanAppData.php
@@ -149,7 +149,7 @@ class ScanAppData extends Base {
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
# restrict the verbosity level to VERBOSITY_VERBOSE
if ($output->getVerbosity() > OutputInterface::VERBOSITY_VERBOSE) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php
index b1d90452c23..92d8fba8f27 100644
--- a/apps/files/lib/Command/TransferOwnership.php
+++ b/apps/files/lib/Command/TransferOwnership.php
@@ -86,7 +86,7 @@ class TransferOwnership extends Command {
);
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$sourceUserObject = $this->userManager->get($input->getArgument('source-user'));
$destinationUserObject = $this->userManager->get($input->getArgument('destination-user'));
diff --git a/apps/files_external/lib/Command/Applicable.php b/apps/files_external/lib/Command/Applicable.php
index 81d7f972f46..bec312bdcb2 100644
--- a/apps/files_external/lib/Command/Applicable.php
+++ b/apps/files_external/lib/Command/Applicable.php
@@ -100,7 +100,7 @@ class Applicable extends Base {
parent::configure();
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$mountId = $input->getArgument('mount_id');
try {
$mount = $this->globalService->getStorage($mountId);
@@ -154,5 +154,6 @@ class Applicable extends Base {
'users' => $applicableUsers,
'groups' => $applicableGroups
]);
+ return 0;
}
}
diff --git a/apps/files_external/lib/Command/Backends.php b/apps/files_external/lib/Command/Backends.php
index e06f5ea5fd1..3bb4b9121ae 100644
--- a/apps/files_external/lib/Command/Backends.php
+++ b/apps/files_external/lib/Command/Backends.php
@@ -59,7 +59,7 @@ class Backends extends Base {
parent::configure();
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$authBackends = $this->backendService->getAuthMechanisms();
$storageBackends = $this->backendService->getBackends();
@@ -87,6 +87,7 @@ class Backends extends Base {
}
$this->writeArrayInOutputFormat($input, $output, $data);
+ return 0;
}
private function serializeAuthBackend(\JsonSerializable $backend) {
diff --git a/apps/files_external/lib/Command/Config.php b/apps/files_external/lib/Command/Config.php
index dde74de3a9c..467f421e730 100644
--- a/apps/files_external/lib/Command/Config.php
+++ b/apps/files_external/lib/Command/Config.php
@@ -64,7 +64,7 @@ class Config extends Base {
parent::configure();
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$mountId = $input->getArgument('mount_id');
$key = $input->getArgument('key');
try {
@@ -80,6 +80,7 @@ class Config extends Base {
} else {
$this->getOption($mount, $key, $output);
}
+ return 0;
}
/**
diff --git a/apps/files_external/lib/Command/Create.php b/apps/files_external/lib/Command/Create.php
index 769ffbec51c..654c7357023 100644
--- a/apps/files_external/lib/Command/Create.php
+++ b/apps/files_external/lib/Command/Create.php
@@ -119,7 +119,7 @@ class Create extends Base {
parent::configure();
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$user = $input->getOption('user');
$mountPoint = $input->getArgument('mount_point');
$storageIdentifier = $input->getArgument('storage_backend');
diff --git a/apps/files_external/lib/Command/Delete.php b/apps/files_external/lib/Command/Delete.php
index c44e35c7fa9..71496e58d14 100644
--- a/apps/files_external/lib/Command/Delete.php
+++ b/apps/files_external/lib/Command/Delete.php
@@ -84,7 +84,7 @@ class Delete extends Base {
parent::configure();
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$mountId = $input->getArgument('mount_id');
try {
$mount = $this->globalService->getStorage($mountId);
@@ -105,10 +105,11 @@ class Delete extends Base {
$question = new ConfirmationQuestion('Delete this mount? [y/N] ', false);
if (!$questionHelper->ask($input, $output, $question)) {
- return null;
+ return 1;
}
}
$this->globalService->removeStorage($mountId);
+ return 0;
}
}
diff --git a/apps/files_external/lib/Command/Export.php b/apps/files_external/lib/Command/Export.php
index 242f408a54d..d670865f29d 100644
--- a/apps/files_external/lib/Command/Export.php
+++ b/apps/files_external/lib/Command/Export.php
@@ -45,7 +45,7 @@ class Export extends ListCommand {
);
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
$listInput = new ArrayInput([], $listCommand->getDefinition());
$listInput->setArgument('user_id', $input->getArgument('user_id'));
@@ -54,5 +54,6 @@ class Export extends ListCommand {
$listInput->setOption('show-password', true);
$listInput->setOption('full', true);
$listCommand->execute($listInput, $output);
+ return 0;
}
}
diff --git a/apps/files_external/lib/Command/Import.php b/apps/files_external/lib/Command/Import.php
index 0e13a521441..bbaeea91c3e 100644
--- a/apps/files_external/lib/Command/Import.php
+++ b/apps/files_external/lib/Command/Import.php
@@ -107,7 +107,7 @@ class Import extends Base {
parent::configure();
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$user = $input->getOption('user');
$path = $input->getArgument('path');
if ($path === '-') {
diff --git a/apps/files_external/lib/Command/ListCommand.php b/apps/files_external/lib/Command/ListCommand.php
index 1e7598ec541..279e581f95e 100644
--- a/apps/files_external/lib/Command/ListCommand.php
+++ b/apps/files_external/lib/Command/ListCommand.php
@@ -96,7 +96,7 @@ class ListCommand extends Base {
parent::configure();
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
if ($input->getOption('all')) {
/** @var $mounts StorageConfig[] */
$mounts = $this->globalService->getStorageForAllUsers();
@@ -110,6 +110,7 @@ class ListCommand extends Base {
}
$this->listMounts($userId, $mounts, $input, $output);
+ return 0;
}
/**
diff --git a/apps/files_external/lib/Command/Notify.php b/apps/files_external/lib/Command/Notify.php
index 4a48a22636c..7f305008402 100644
--- a/apps/files_external/lib/Command/Notify.php
+++ b/apps/files_external/lib/Command/Notify.php
@@ -88,7 +88,7 @@ class Notify extends Base {
parent::configure();
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$mount = $this->globalService->getStorage($input->getArgument('mount_id'));
if (is_null($mount)) {
$output->writeln('<error>Mount not found</error>');
@@ -147,6 +147,7 @@ class Notify extends Base {
}
$this->markParentAsOutdated($mount->getId(), $change->getPath(), $output);
});
+ return 0;
}
private function createStorage(StorageConfig $mount) {
diff --git a/apps/files_external/lib/Command/Verify.php b/apps/files_external/lib/Command/Verify.php
index 8e1fa71cf8b..e5bfb3052ee 100644
--- a/apps/files_external/lib/Command/Verify.php
+++ b/apps/files_external/lib/Command/Verify.php
@@ -65,7 +65,7 @@ class Verify extends Base {
parent::configure();
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$mountId = $input->getArgument('mount_id');
$configInput = $input->getOption('config');
@@ -83,6 +83,7 @@ class Verify extends Base {
'code' => $mount->getStatus(),
'message' => $mount->getStatusMessage()
]);
+ return 0;
}
private function manipulateStorageConfig(StorageConfig $storage) {
diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
index 2eb79f87762..259e55ff620 100644
--- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
+++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
@@ -59,7 +59,7 @@ class CleanupRemoteStorages extends Command {
);
}
- public function execute(InputInterface $input, OutputInterface $output) {
+ public function execute(InputInterface $input, OutputInterface $output): int {
$remoteStorages = $this->getRemoteStorages();
$output->writeln(count($remoteStorages) . ' remote storage(s) need(s) to be checked');
@@ -93,6 +93,7 @@ class CleanupRemoteStorages extends Command {
}
}
}
+ return 0;
}
public function countFiles($numericId, OutputInterface $output) {
diff --git a/apps/files_sharing/lib/Command/ExiprationNotification.php b/apps/files_sharing/lib/Command/ExiprationNotification.php
index 6fd04bcdccc..1df49943188 100644
--- a/apps/files_sharing/lib/Command/ExiprationNotification.php
+++ b/apps/files_sharing/lib/Command/ExiprationNotification.php
@@ -63,7 +63,7 @@ class ExiprationNotification extends Command {
->setDescription('Notify share initiators when a share will expire the next day.');
}
- public function execute(InputInterface $input, OutputInterface $output) {
+ public function execute(InputInterface $input, OutputInterface $output): int {
//Current time
$minTime = $this->time->getDateTime();
$minTime->add(new \DateInterval('P1D'));
@@ -94,5 +94,6 @@ class ExiprationNotification extends Command {
$notification->setUser($share->getSharedBy());
$this->notificationManager->notify($notification);
}
+ return 0;
}
}
diff --git a/apps/files_trashbin/lib/Command/CleanUp.php b/apps/files_trashbin/lib/Command/CleanUp.php
index 7192ed26094..1b61c1ae74d 100644
--- a/apps/files_trashbin/lib/Command/CleanUp.php
+++ b/apps/files_trashbin/lib/Command/CleanUp.php
@@ -77,7 +77,7 @@ class CleanUp extends Command {
);
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$users = $input->getArgument('user_id');
if ((!empty($users)) and ($input->getOption('all-users'))) {
throw new InvalidOptionException('Either specify a user_id or --all-users');
@@ -88,6 +88,7 @@ class CleanUp extends Command {
$this->removeDeletedFiles($user);
} else {
$output->writeln("<error>Unknown user $user</error>");
+ return 1;
}
}
} elseif ($input->getOption('all-users')) {
@@ -112,6 +113,7 @@ class CleanUp extends Command {
} else {
throw new InvalidOptionException('Either specify a user_id or --all-users');
}
+ return 0;
}
/**
diff --git a/apps/files_trashbin/lib/Command/ExpireTrash.php b/apps/files_trashbin/lib/Command/ExpireTrash.php
index 7cc6c83b369..26088aad37d 100644
--- a/apps/files_trashbin/lib/Command/ExpireTrash.php
+++ b/apps/files_trashbin/lib/Command/ExpireTrash.php
@@ -42,7 +42,7 @@ class ExpireTrash extends Command {
* @var Expiration
*/
private $expiration;
-
+
/**
* @var IUserManager
*/
@@ -71,11 +71,11 @@ class ExpireTrash extends Command {
);
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$maxAge = $this->expiration->getMaxAgeAsTimestamp();
if (!$maxAge) {
$output->writeln("No expiry configured.");
- return;
+ return 1;
}
$users = $input->getArgument('user_id');
@@ -87,6 +87,7 @@ class ExpireTrash extends Command {
$this->expireTrashForUser($userObject);
} else {
$output->writeln("<error>Unknown user $user</error>");
+ return 1;
}
}
} else {
@@ -99,6 +100,7 @@ class ExpireTrash extends Command {
$p->finish();
$output->writeln('');
}
+ return 0;
}
public function expireTrashForUser(IUser $user) {
diff --git a/apps/files_versions/lib/Command/CleanUp.php b/apps/files_versions/lib/Command/CleanUp.php
index d49835f2db4..d67df024a1b 100644
--- a/apps/files_versions/lib/Command/CleanUp.php
+++ b/apps/files_versions/lib/Command/CleanUp.php
@@ -61,7 +61,7 @@ class CleanUp extends Command {
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$users = $input->getArgument('user_id');
if (!empty($users)) {
foreach ($users as $user) {
@@ -70,6 +70,7 @@ class CleanUp extends Command {
$this->deleteVersions($user);
} else {
$output->writeln("<error>Unknown user $user</error>");
+ return 1;
}
}
} else {
@@ -95,6 +96,7 @@ class CleanUp extends Command {
} while (count($users) >= $limit);
}
}
+ return 0;
}
diff --git a/apps/files_versions/lib/Command/ExpireVersions.php b/apps/files_versions/lib/Command/ExpireVersions.php
index a48908dcd6b..e3b444e8f46 100644
--- a/apps/files_versions/lib/Command/ExpireVersions.php
+++ b/apps/files_versions/lib/Command/ExpireVersions.php
@@ -41,7 +41,7 @@ class ExpireVersions extends Command {
* @var Expiration
*/
private $expiration;
-
+
/**
* @var IUserManager
*/
@@ -70,7 +70,7 @@ class ExpireVersions extends Command {
);
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$maxAge = $this->expiration->getMaxAgeAsTimestamp();
if (!$maxAge) {
$output->writeln("No expiry configured.");
@@ -86,6 +86,7 @@ class ExpireVersions extends Command {
$this->expireVersionsForUser($userObject);
} else {
$output->writeln("<error>Unknown user $user</error>");
+ return 1;
}
}
} else {
@@ -98,6 +99,7 @@ class ExpireVersions extends Command {
$p->finish();
$output->writeln('');
}
+ return 0;
}
public function expireVersionsForUser(IUser $user) {
diff --git a/apps/updatenotification/lib/Command/Check.php b/apps/updatenotification/lib/Command/Check.php
index 88d7e1d4fac..351350ba3ee 100644
--- a/apps/updatenotification/lib/Command/Check.php
+++ b/apps/updatenotification/lib/Command/Check.php
@@ -63,7 +63,7 @@ class Check extends Command {
;
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$updatesAvailableCount = 0;
// Server
diff --git a/apps/user_ldap/lib/Command/CheckUser.php b/apps/user_ldap/lib/Command/CheckUser.php
index 9b2c6d93de3..5314cac365a 100644
--- a/apps/user_ldap/lib/Command/CheckUser.php
+++ b/apps/user_ldap/lib/Command/CheckUser.php
@@ -87,7 +87,7 @@ class CheckUser extends Command {
;
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
try {
$uid = $input->getArgument('ocName');
$this->isAllowed($input->getOption('force'));
@@ -98,15 +98,17 @@ class CheckUser extends Command {
if ($input->getOption('update')) {
$this->updateUser($uid, $output);
}
- return;
+ return 0;
}
$this->dui->markUser($uid);
$output->writeln('The user does not exists on LDAP anymore.');
$output->writeln('Clean up the user\'s remnants by: ./occ user:delete "'
. $uid . '"');
+ return 0;
} catch (\Exception $e) {
$output->writeln('<error>' . $e->getMessage(). '</error>');
+ return 1;
}
}
diff --git a/apps/user_ldap/lib/Command/CreateEmptyConfig.php b/apps/user_ldap/lib/Command/CreateEmptyConfig.php
index 3f42020c1e9..4d88bf80c5e 100644
--- a/apps/user_ldap/lib/Command/CreateEmptyConfig.php
+++ b/apps/user_ldap/lib/Command/CreateEmptyConfig.php
@@ -58,7 +58,7 @@ class CreateEmptyConfig extends Command {
;
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$configPrefix = $this->helper->getNextServerConfigurationPrefix();
$configHolder = new Configuration($configPrefix);
$configHolder->saveConfiguration();
@@ -68,5 +68,6 @@ class CreateEmptyConfig extends Command {
$prose = 'Created new configuration with configID ';
}
$output->writeln($prose . "{$configPrefix}");
+ return 0;
}
}
diff --git a/apps/user_ldap/lib/Command/DeleteConfig.php b/apps/user_ldap/lib/Command/DeleteConfig.php
index 43a5055e8ad..c76ba6f296b 100644
--- a/apps/user_ldap/lib/Command/DeleteConfig.php
+++ b/apps/user_ldap/lib/Command/DeleteConfig.php
@@ -57,15 +57,17 @@ class DeleteConfig extends Command {
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$configPrefix = $input->getArgument('configID');
$success = $this->helper->deleteServerConfiguration($configPrefix);
if ($success) {
$output->writeln("Deleted configuration with configID '{$configPrefix}'");
+ return 0;
} else {
$output->writeln("Cannot delete configuration with configID '{$configPrefix}'");
+ return 1;
}
}
}
diff --git a/apps/user_ldap/lib/Command/Search.php b/apps/user_ldap/lib/Command/Search.php
index 1389f2eca52..f19c11a4666 100644
--- a/apps/user_ldap/lib/Command/Search.php
+++ b/apps/user_ldap/lib/Command/Search.php
@@ -105,7 +105,7 @@ class Search extends Command {
}
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$helper = new Helper($this->ocConfig);
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
$ldapWrapper = new LDAP();
@@ -141,5 +141,6 @@ class Search extends Command {
$line = $name . ($printID ? ' ('.$id.')' : '');
$output->writeln($line);
}
+ return 0;
}
}
diff --git a/apps/user_ldap/lib/Command/SetConfig.php b/apps/user_ldap/lib/Command/SetConfig.php
index 53a480c652d..2b2fdfe5c8b 100644
--- a/apps/user_ldap/lib/Command/SetConfig.php
+++ b/apps/user_ldap/lib/Command/SetConfig.php
@@ -59,13 +59,13 @@ class SetConfig extends Command {
;
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$helper = new Helper(\OC::$server->getConfig());
$availableConfigs = $helper->getServerConfigurationPrefixes();
$configID = $input->getArgument('configID');
if (!in_array($configID, $availableConfigs)) {
$output->writeln("Invalid configID");
- return;
+ return 1;
}
$this->setValue(
@@ -73,6 +73,7 @@ class SetConfig extends Command {
$input->getArgument('configKey'),
$input->getArgument('configValue')
);
+ return 0;
}
/**
diff --git a/apps/user_ldap/lib/Command/ShowConfig.php b/apps/user_ldap/lib/Command/ShowConfig.php
index cbd94287f9b..80af5718dcb 100644
--- a/apps/user_ldap/lib/Command/ShowConfig.php
+++ b/apps/user_ldap/lib/Command/ShowConfig.php
@@ -66,20 +66,21 @@ class ShowConfig extends Command {
;
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$availableConfigs = $this->helper->getServerConfigurationPrefixes();
$configID = $input->getArgument('configID');
if (!is_null($configID)) {
$configIDs[] = $configID;
if (!in_array($configIDs[0], $availableConfigs)) {
$output->writeln("Invalid configID");
- return;
+ return 1;
}
} else {
$configIDs = $availableConfigs;
}
$this->renderConfigs($configIDs, $output, $input->getOption('show-password'));
+ return 0;
}
/**
diff --git a/apps/user_ldap/lib/Command/ShowRemnants.php b/apps/user_ldap/lib/Command/ShowRemnants.php
index 034168cbd3f..4722bf76ce1 100644
--- a/apps/user_ldap/lib/Command/ShowRemnants.php
+++ b/apps/user_ldap/lib/Command/ShowRemnants.php
@@ -75,7 +75,7 @@ class ShowRemnants extends Command {
*
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
/** @var \Symfony\Component\Console\Helper\Table $table */
$table = new Table($output);
$table->setHeaders([
@@ -103,5 +103,6 @@ class ShowRemnants extends Command {
$table->setRows($rows);
$table->render($output);
}
+ return 0;
}
}
diff --git a/apps/user_ldap/lib/Command/TestConfig.php b/apps/user_ldap/lib/Command/TestConfig.php
index 0973e6245b3..b588a8380d0 100644
--- a/apps/user_ldap/lib/Command/TestConfig.php
+++ b/apps/user_ldap/lib/Command/TestConfig.php
@@ -47,13 +47,13 @@ class TestConfig extends Command {
;
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$helper = new Helper(\OC::$server->getConfig());
$availableConfigs = $helper->getServerConfigurationPrefixes();
$configID = $input->getArgument('configID');
if (!in_array($configID, $availableConfigs)) {
$output->writeln("Invalid configID");
- return;
+ return 1;
}
$result = $this->testConfig($configID);
@@ -61,11 +61,13 @@ class TestConfig extends Command {
$output->writeln('The configuration is valid and the connection could be established!');
} elseif ($result === 1) {
$output->writeln('The configuration is invalid. Please have a look at the logs for further details.');
+ return 1;
} elseif ($result === 2) {
$output->writeln('The configuration is valid, but the Bind failed. Please check the server settings and credentials.');
} else {
$output->writeln('Your LDAP server was kidnapped by aliens.');
}
+ return 0;
}
/**
diff --git a/apps/workflowengine/lib/Command/Index.php b/apps/workflowengine/lib/Command/Index.php
index 5f901c262df..fdc83b1d3c2 100644
--- a/apps/workflowengine/lib/Command/Index.php
+++ b/apps/workflowengine/lib/Command/Index.php
@@ -69,7 +69,7 @@ class Index extends Command {
return $scopes[$scope] ?? -1;
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$ops = $this->manager->getAllOperations(
new ScopeContext(
$this->mappedScope($input->getArgument('scope')),
@@ -77,5 +77,6 @@ class Index extends Command {
)
);
$output->writeln(\json_encode($ops));
+ return 0;
}
}