Skip to content

Commit

Permalink
cmd: improve index logging
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Oct 14, 2023
1 parent 8fb257f commit 99dfbef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 2 additions & 4 deletions lib/Command/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ protected function checkClear(): void
}

$this->timelineWrite->clear();
$this->output->writeln('Cleared existing index');
$this->output->writeln('<info>Cleared existing index</info>');
}

/**
Expand All @@ -191,9 +191,7 @@ protected function runIndex(): void
{
$this->runForUsers(function (IUser $user) {
try {
$uid = $user->getUID();
$this->output->writeln("Indexing user {$uid}");
$this->indexer->indexUser($uid, $this->opts->folder);
$this->indexer->indexUser($user->getUID(), $this->opts->folder);
} catch (\Exception $e) {
$this->output->writeln("<error>{$e->getMessage()}</error>\n");
}
Expand Down
6 changes: 4 additions & 2 deletions lib/Service/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public function __construct(
*/
public function indexUser(string $uid, ?string $folder = null): void
{
$this->log("<info>Indexing user {$uid}</info>".PHP_EOL);

\OC_Util::tearDownFS();
\OC_Util::setupFS($uid);

Expand Down Expand Up @@ -121,7 +123,7 @@ public function indexUser(string $uid, ?string $folder = null): void
public function indexFolder(Folder $folder): void
{
if ($folder->nodeExists('.nomedia') || $folder->nodeExists('.nomemories')) {
$this->log("Skipping folder {$folder->getPath()} due to .nomedia or .nomemories file\n", true);
$this->log("Skipping folder {$folder->getPath()} (.nomedia / .nomemories)\n", true);

return;
}
Expand Down Expand Up @@ -215,7 +217,7 @@ public function indexFile(File $file): void
*/
public function cleanupStale(): void
{
$this->log('Cleaning up stale index entries'.PHP_EOL);
$this->log('<info>Cleaning up stale index entries</info>'.PHP_EOL);
$this->timelineWrite->cleanupStale();
}

Expand Down

0 comments on commit 99dfbef

Please sign in to comment.