aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib/Command/DeleteOrphanedFiles.php
diff options
context:
space:
mode:
authorFaraz Samapoor <f.samapoor@gmail.com>2023-07-04 22:13:32 +0330
committerFaraz Samapoor <fsa@adlas.at>2023-07-12 18:29:32 +0330
commit5d242aa2f86f003bb5f0400188a440d2d5eea68f (patch)
tree514599caddf25a0b6d8414ce510f7b4c41f03b62 /apps/files/lib/Command/DeleteOrphanedFiles.php
parent706c141fffce928d344fe2f039da549fad065393 (diff)
downloadnextcloud-server-5d242aa2f86f003bb5f0400188a440d2d5eea68f.tar.gz
nextcloud-server-5d242aa2f86f003bb5f0400188a440d2d5eea68f.zip
Refactors files app commands.
To improve code readability. Signed-off-by: Faraz Samapoor <fsa@adlas.at>
Diffstat (limited to 'apps/files/lib/Command/DeleteOrphanedFiles.php')
-rw-r--r--apps/files/lib/Command/DeleteOrphanedFiles.php16
1 files changed, 6 insertions, 10 deletions
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();