summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-03-17 09:59:25 +0100
committerJoas Schilling <coding@schilljs.com>2017-03-17 09:59:25 +0100
commit0a1135a7cc88e039664eece4635c685f482e4da7 (patch)
tree21388581c5d5e4826ff944ba74d742a653a0ae62 /apps
parent5155a5288c90eb9ccfb432d051d95e3777653eb7 (diff)
downloadnextcloud-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.php23
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() {