From eb784ef8aba56ee8e7b6d476390d6b7927aa7608 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Fri, 24 Nov 2023 14:50:15 -0800 Subject: [PATCH] occ: improve index output Signed-off-by: Varun Patil --- lib/Command/Index.php | 8 ++++---- lib/Service/Index.php | 11 ++++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/Command/Index.php b/lib/Command/Index.php index d06a868d..0b07455e 100644 --- a/lib/Command/Index.php +++ b/lib/Command/Index.php @@ -120,7 +120,7 @@ class Index extends Command return 0; } catch (\Exception $e) { - $this->output->writeln("{$e->getMessage()}\n"); + $this->output->writeln("{$e->getMessage()}".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("{$e->getMessage()}\n"); + $this->output->writeln("{$e->getMessage()}".PHP_EOL); } }); } @@ -190,7 +190,7 @@ class Index extends Command if ($user = $this->userManager->get($uid)) { $closure($user); } else { - $this->output->writeln("User {$uid} not found\n"); + $this->output->writeln("User {$uid} not found".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("Group {$gid} not found\n"); + $this->output->writeln("Group {$gid} not found".PHP_EOL); } } else { $this->userManager->callForSeenUsers($closure); diff --git a/lib/Service/Index.php b/lib/Service/Index.php index dedf839d..91f1ee25 100644 --- a/lib/Service/Index.php +++ b/lib/Service/Index.php @@ -69,7 +69,7 @@ class Index */ public function indexUser(string $uid, ?string $folder = null): void { - $this->log("Indexing user {$uid}".PHP_EOL); + $this->log("Indexing user {$uid}".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('Cleaning up stale index entries'.PHP_EOL); + $this->log('Cleaning up stale index entries'); $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("{$message}\n"); - } + $this->output?->writeln("{$message}".PHP_EOL); } /**