Skip to content

Commit

Permalink
occ: improve index output
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <radialapps@gmail.com>
  • Loading branch information
pulsejet committed Nov 24, 2023
1 parent e5e35ce commit eb784ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
8 changes: 4 additions & 4 deletions lib/Command/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

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 {
Expand Down Expand Up @@ -174,7 +174,7 @@ protected function runIndex(): void
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);
}
});
}
Expand All @@ -190,15 +190,15 @@ private function runForUsers(\Closure $closure): void
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)) {
foreach ($group->getUsers() as $user) {
$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);
Expand Down
11 changes: 4 additions & 7 deletions lib/Service/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __construct(
*/
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);
Expand Down Expand Up @@ -119,7 +119,7 @@ public function indexFolder(Folder $folder): void
$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;
}
Expand Down Expand Up @@ -210,7 +210,7 @@ public function indexFile(File $file): void
*/
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();
}

Expand Down Expand Up @@ -281,10 +281,7 @@ public static function isVideo(File $file): bool
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);
}

/**
Expand Down

0 comments on commit eb784ef

Please sign in to comment.