occ: improve index output

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/953/head
Varun Patil 2023-11-24 14:50:15 -08:00
parent e5e35ce357
commit eb784ef8ab
2 changed files with 8 additions and 11 deletions

View File

@ -120,7 +120,7 @@ class Index extends Command
return 0;
} catch (\Exception $e) {
$this->output->writeln("<error>{$e->getMessage()}</error>\n");
$this->output->writeln("<error>{$e->getMessage()}</error>".PHP_EOL);
return 1;
} finally {
@ -174,7 +174,7 @@ class Index extends Command
try {
$this->indexer->indexUser($user->getUID(), $this->opts->folder);
} catch (\Exception $e) {
$this->output->writeln("<error>{$e->getMessage()}</error>\n");
$this->output->writeln("<error>{$e->getMessage()}</error>".PHP_EOL);
}
});
}
@ -190,7 +190,7 @@ class Index extends Command
if ($user = $this->userManager->get($uid)) {
$closure($user);
} else {
$this->output->writeln("<error>User {$uid} not found</error>\n");
$this->output->writeln("<error>User {$uid} not found</error>".PHP_EOL);
}
} elseif ($gid = $this->opts->group) {
if ($group = $this->groupManager->get($gid)) {
@ -198,7 +198,7 @@ class Index extends Command
$closure($user);
}
} else {
$this->output->writeln("<error>Group {$gid} not found</error>\n");
$this->output->writeln("<error>Group {$gid} not found</error>".PHP_EOL);
}
} else {
$this->userManager->callForSeenUsers($closure);

View File

@ -69,7 +69,7 @@ class Index
*/
public function indexUser(string $uid, ?string $folder = null): void
{
$this->log("<info>Indexing user {$uid}</info>".PHP_EOL);
$this->log("<info>Indexing user {$uid}</info>".PHP_EOL, true);
\OC_Util::tearDownFS();
\OC_Util::setupFS($uid);
@ -119,7 +119,7 @@ class Index
$this->log("Indexing folder {$path}", true);
if ($folder->nodeExists('.nomedia') || $folder->nodeExists('.nomemories')) {
$this->log("Skipping folder {$path} (.nomedia / .nomemories)\n", true);
$this->log("Skipping folder {$path} (.nomedia / .nomemories)".PHP_EOL, true);
return;
}
@ -210,7 +210,7 @@ class Index
*/
public function cleanupStale(): void
{
$this->log('<info>Cleaning up stale index entries</info>'.PHP_EOL);
$this->log('<info>Cleaning up stale index entries</info>');
$this->tw->cleanupStale();
}
@ -281,10 +281,7 @@ class Index
private function error(string $message): void
{
$this->logger->error($message, ['app' => 'memories']);
if ($this->output) {
$this->output->writeln("<error>{$message}</error>\n");
}
$this->output?->writeln("<error>{$message}</error>".PHP_EOL);
}
/**