From 5d242aa2f86f003bb5f0400188a440d2d5eea68f Mon Sep 17 00:00:00 2001 From: Faraz Samapoor Date: Tue, 4 Jul 2023 22:13:32 +0330 Subject: Refactors files app commands. To improve code readability. Signed-off-by: Faraz Samapoor --- apps/files/lib/Command/DeleteOrphanedFiles.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'apps/files/lib/Command/DeleteOrphanedFiles.php') diff --git a/apps/files/lib/Command/DeleteOrphanedFiles.php b/apps/files/lib/Command/DeleteOrphanedFiles.php index e3305fe3b9b..4b7179271f5 100644 --- a/apps/files/lib/Command/DeleteOrphanedFiles.php +++ b/apps/files/lib/Command/DeleteOrphanedFiles.php @@ -35,17 +35,13 @@ use Symfony\Component\Console\Output\OutputInterface; class DeleteOrphanedFiles extends Command { public const CHUNK_SIZE = 200; - /** - * @var IDBConnection - */ - protected $connection; - - public function __construct(IDBConnection $connection) { - $this->connection = $connection; + public function __construct( + protected IDBConnection $connection, + ) { parent::__construct(); } - protected function configure() { + protected function configure(): void { $this ->setName('files:cleanup') ->setDescription('cleanup filecache'); @@ -81,10 +77,10 @@ class DeleteOrphanedFiles extends Command { $deletedMounts = $this->cleanupOrphanedMounts(); $output->writeln("$deletedMounts orphaned mount entries deleted"); - return 0; + return self::SUCCESS; } - private function cleanupOrphanedMounts() { + private function cleanupOrphanedMounts(): int { $deletedEntries = 0; $query = $this->connection->getQueryBuilder(); -- cgit v1.2.3