diff options
author | Joas Schilling <coding@schilljs.com> | 2017-03-17 09:59:25 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-03-17 09:59:25 +0100 |
commit | 0a1135a7cc88e039664eece4635c685f482e4da7 (patch) | |
tree | 21388581c5d5e4826ff944ba74d742a653a0ae62 /apps | |
parent | 5155a5288c90eb9ccfb432d051d95e3777653eb7 (diff) | |
download | nextcloud-server-0a1135a7cc88e039664eece4635c685f482e4da7.tar.gz nextcloud-server-0a1135a7cc88e039664eece4635c685f482e4da7.zip |
Better output
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/Command/CleanupRemoteStorages.php | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php index ec98b46267f..a94832c1bb9 100644 --- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php +++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php @@ -47,7 +47,7 @@ class CleanupRemoteStorages extends Command { protected function configure() { $this ->setName('sharing:cleanup-remote-storages') - ->setDescription('Cleanup \'shared::\' storage entries that have no matching entries in the shares_external table') + ->setDescription('Cleanup shared storage entries that have no matching entry in the shares_external table') ->addOption( 'dry-run', null, @@ -68,20 +68,23 @@ class CleanupRemoteStorages extends Command { foreach ($remoteShareIds as $id => $remoteShareId) { if (isset($remoteStorages[$remoteShareId])) { - $output->writeln("$remoteShareId belongs to remote share $id"); + if ($input->getOption('dry-run') || $output->isVerbose()) { + $output->writeln("<info>$remoteShareId belongs to remote share $id</info>"); + } + unset($remoteStorages[$remoteShareId]); } else { - $output->writeln("$remoteShareId for share $id has no matching storage, yet"); + $output->writeln("<comment>$remoteShareId for share $id has no matching storage, yet</comment>"); } } if (empty($remoteStorages)) { - $output->writeln("no storages deleted"); + $output->writeln("<info>no storages deleted</info>"); } else { $dryRun = $input->getOption('dry-run'); foreach ($remoteStorages as $id => $numericId) { if ($dryRun) { - $output->writeln("$id [$numericId] can be deleted"); + $output->writeln("<error>$id [$numericId] can be deleted</error>"); $this->countFiles($numericId, $output); } else { $this->deleteStorage($id, $numericId, $output); @@ -90,7 +93,7 @@ class CleanupRemoteStorages extends Command { } } - public function countFiles ($numericId, OutputInterface $output) { + public function countFiles($numericId, OutputInterface $output) { $queryBuilder = $this->connection->getQueryBuilder(); $queryBuilder->select($queryBuilder->createFunction('count(fileid)')) ->from('filecache') @@ -104,7 +107,7 @@ class CleanupRemoteStorages extends Command { $output->writeln("$count files can be deleted for storage $numericId"); } - public function deleteStorage ($id, $numericId, OutputInterface $output) { + public function deleteStorage($id, $numericId, OutputInterface $output) { $queryBuilder = $this->connection->getQueryBuilder(); $queryBuilder->delete('storages') ->where($queryBuilder->expr()->eq( @@ -114,11 +117,11 @@ class CleanupRemoteStorages extends Command { ); $output->write("deleting $id [$numericId] ... "); $count = $queryBuilder->execute(); - $output->writeln("deleted $count"); + $output->writeln("deleted $count storage"); $this->deleteFiles($numericId, $output); } - public function deleteFiles ($numericId, OutputInterface $output) { + public function deleteFiles($numericId, OutputInterface $output) { $queryBuilder = $this->connection->getQueryBuilder(); $queryBuilder->delete('filecache') ->where($queryBuilder->expr()->eq( @@ -128,7 +131,7 @@ class CleanupRemoteStorages extends Command { ); $output->write("deleting files for storage $numericId ... "); $count = $queryBuilder->execute(); - $output->writeln("deleted $count"); + $output->writeln("deleted $count files"); } public function getRemoteStorages() { |