aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php')
-rw-r--r--lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php70
1 files changed, 18 insertions, 52 deletions
diff --git a/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php b/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php
index 7f4bbc35c17..6c606453bb9 100644
--- a/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php
+++ b/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php
@@ -1,30 +1,16 @@
<?php
+
+declare(strict_types=1);
+
/**
- * @copyright 2016 Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Repair\Owncloud;
-use OC\BackgroundJob\QueuedJob;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
+use OCP\BackgroundJob\QueuedJob;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
@@ -33,33 +19,14 @@ use OCP\IUserManager;
use Psr\Log\LoggerInterface;
class CleanPreviewsBackgroundJob extends QueuedJob {
- /** @var IRootFolder */
- private $rootFolder;
-
- private LoggerInterface $logger;
-
- /** @var IJobList */
- private $jobList;
-
- /** @var ITimeFactory */
- private $timeFactory;
-
- /** @var IUserManager */
- private $userManager;
-
- /**
- * CleanPreviewsBackgroundJob constructor.
- */
- public function __construct(IRootFolder $rootFolder,
- LoggerInterface $logger,
- IJobList $jobList,
- ITimeFactory $timeFactory,
- IUserManager $userManager) {
- $this->rootFolder = $rootFolder;
- $this->logger = $logger;
- $this->jobList = $jobList;
- $this->timeFactory = $timeFactory;
- $this->userManager = $userManager;
+ public function __construct(
+ private IRootFolder $rootFolder,
+ private LoggerInterface $logger,
+ private IJobList $jobList,
+ ITimeFactory $timeFactory,
+ private IUserManager $userManager,
+ ) {
+ parent::__construct($timeFactory);
}
public function run($arguments) {
@@ -80,10 +47,9 @@ class CleanPreviewsBackgroundJob extends QueuedJob {
}
/**
- * @param $uid
- * @return bool
+ * @param string $uid
*/
- private function cleanupPreviews($uid) {
+ private function cleanupPreviews($uid): bool {
try {
$userFolder = $this->rootFolder->getUserFolder($uid);
} catch (NotFoundException $e) {
@@ -101,7 +67,7 @@ class CleanPreviewsBackgroundJob extends QueuedJob {
$thumbnails = $thumbnailFolder->getDirectoryListing();
- $start = $this->timeFactory->getTime();
+ $start = $this->time->getTime();
foreach ($thumbnails as $thumbnail) {
try {
$thumbnail->delete();
@@ -109,7 +75,7 @@ class CleanPreviewsBackgroundJob extends QueuedJob {
// Ignore
}
- if (($this->timeFactory->getTime() - $start) > 15) {
+ if (($this->time->getTime() - $start) > 15) {
return false;
}
}