Better output
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
5155a5288c
commit
0a1135a7cc
|
@ -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);
|
||||
|
@ -114,7 +117,7 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue