'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.");
$name = $input->getArgument('name');
$this->cardDavBackend->createAddressBook("principals/users/$user", $name, []);
+ return 0;
}
}
'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.");
$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;
}
}
'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.");
} else {
$output->writeln("<info>User <$user> has no calendars</info>");
}
+ return 0;
}
}
->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');
$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;
}
/**
->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')
}
$result->closeCursor();
+ return 0;
}
/**
* @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;
}
}
* @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');
$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);
$p->finish();
$output->writeln('');
+ return 0;
}
protected function verifyEnabled() {
* @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();
$progress->finish();
$output->writeln('');
+ return 0;
}
}
->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) {
$output->writeln('Master key successfully disabled.');
} else {
$output->writeln('aborted.');
+ return 1;
}
}
+ return 0;
}
}
->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) {
$output->writeln('Master key successfully enabled.');
} else {
$output->writeln('aborted.');
+ return 1;
}
}
+ return 0;
}
}
);
}
- 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: ');
$output->write('Start to recover users files... This can take some time...');
$this->userManager->get($uid)->setPassword($newLoginPassword, $recoveryPassword);
$output->writeln('Done.');
+ return 0;
}
}
* @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) {
->setDescription('cleanup filecache');
}
- public function execute(InputInterface $input, OutputInterface $output) {
+ public function execute(InputInterface $input, OutputInterface $output): int {
$deletedEntries = 0;
$query = $this->connection->getQueryBuilder();
}
$output->writeln("$deletedEntries orphaned file cache entries deleted");
+ return 0;
}
}
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, '/');
$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();
}
$this->presentStats($output);
+ return 0;
}
/**
}
- 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);
);
}
- 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'));
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);
'users' => $applicableUsers,
'groups' => $applicableGroups
]);
+ return 0;
}
}
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();
}
$this->writeArrayInOutputFormat($input, $output, $data);
+ return 0;
}
private function serializeAuthBackend(\JsonSerializable $backend) {
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 {
} else {
$this->getOption($mount, $key, $output);
}
+ return 0;
}
/**
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');
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);
$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;
}
}
);
}
- 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'));
$listInput->setOption('show-password', true);
$listInput->setOption('full', true);
$listCommand->execute($listInput, $output);
+ return 0;
}
}
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 === '-') {
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();
}
$this->listMounts($userId, $mounts, $input, $output);
+ return 0;
}
/**
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>');
}
$this->markParentAsOutdated($mount->getId(), $change->getPath(), $output);
});
+ return 0;
}
private function createStorage(StorageConfig $mount) {
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');
'code' => $mount->getStatus(),
'message' => $mount->getStatusMessage()
]);
+ return 0;
}
private function manipulateStorageConfig(StorageConfig $storage) {
);
}
- 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');
}
}
}
+ return 0;
}
public function countFiles($numericId, OutputInterface $output) {
->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'));
$notification->setUser($share->getSharedBy());
$this->notificationManager->notify($notification);
}
+ return 0;
}
}
);
}
- 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');
$this->removeDeletedFiles($user);
} else {
$output->writeln("<error>Unknown user $user</error>");
+ return 1;
}
}
} elseif ($input->getOption('all-users')) {
} else {
throw new InvalidOptionException('Either specify a user_id or --all-users');
}
+ return 0;
}
/**
* @var Expiration
*/
private $expiration;
-
+
/**
* @var IUserManager
*/
);
}
- 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');
$this->expireTrashForUser($userObject);
} else {
$output->writeln("<error>Unknown user $user</error>");
+ return 1;
}
}
} else {
$p->finish();
$output->writeln('');
}
+ return 0;
}
public function expireTrashForUser(IUser $user) {
}
- 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) {
$this->deleteVersions($user);
} else {
$output->writeln("<error>Unknown user $user</error>");
+ return 1;
}
}
} else {
} while (count($users) >= $limit);
}
}
+ return 0;
}
* @var Expiration
*/
private $expiration;
-
+
/**
* @var IUserManager
*/
);
}
- 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.");
$this->expireVersionsForUser($userObject);
} else {
$output->writeln("<error>Unknown user $user</error>");
+ return 1;
}
}
} else {
$p->finish();
$output->writeln('');
}
+ return 0;
}
public function expireVersionsForUser(IUser $user) {
;
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$updatesAvailableCount = 0;
// Server
;
}
- 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'));
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;
}
}
;
}
- 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();
$prose = 'Created new configuration with configID ';
}
$output->writeln($prose . "{$configPrefix}");
+ return 0;
}
}
}
- 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;
}
}
}
}
}
- 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();
$line = $name . ($printID ? ' ('.$id.')' : '');
$output->writeln($line);
}
+ return 0;
}
}
;
}
- 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(
$input->getArgument('configKey'),
$input->getArgument('configValue')
);
+ return 0;
}
/**
;
}
- 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;
}
/**
*
* {@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([
$table->setRows($rows);
$table->render($output);
}
+ return 0;
}
}
;
}
- 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);
$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;
}
/**
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')),
)
);
$output->writeln(\json_encode($ops));
+ return 0;
}
}