summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-08-23 16:55:42 +0200
committerGitHub <noreply@github.com>2022-08-23 16:55:42 +0200
commitb888c6146327d842e21988b0d90d6ade4f3a9435 (patch)
treeaa115b3d420cb6ccfa18a6a5af146eff8578b82c /apps/files_trashbin/lib
parent5f90a6a5e2da08e7098cc44937c1713375823e74 (diff)
parent49334e4d9c278d33ce9fd4195b5a12af99821be2 (diff)
downloadnextcloud-server-b888c6146327d842e21988b0d90d6ade4f3a9435.tar.gz
nextcloud-server-b888c6146327d842e21988b0d90d6ade4f3a9435.zip
Merge pull request #33047 from nextcloud/fix/ijob-logger-deprecated
Deprecated ILogger from IJob
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r--apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php52
1 files changed, 17 insertions, 35 deletions
diff --git a/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php b/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php
index 9e35273544b..c76033e0c79 100644
--- a/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php
+++ b/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php
@@ -30,46 +30,30 @@ use OCA\Files_Trashbin\AppInfo\Application;
use OCA\Files_Trashbin\Expiration;
use OCA\Files_Trashbin\Helper;
use OCA\Files_Trashbin\Trashbin;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
use OCP\IUser;
use OCP\IUserManager;
-class ExpireTrash extends \OC\BackgroundJob\TimedJob {
+class ExpireTrash extends TimedJob {
+ private IConfig $config;
+ private Expiration $expiration;
+ private IUserManager $userManager;
- /** @var IConfig */
- private $config;
-
- /**
- * @var Expiration
- */
- private $expiration;
-
- /**
- * @var IUserManager
- */
- private $userManager;
-
- public function __construct(IConfig $config = null,
- IUserManager $userManager = null,
- Expiration $expiration = null) {
+ public function __construct(
+ IConfig $config,
+ IUserManager $userManager,
+ Expiration $expiration,
+ ITimeFactory $time
+ ) {
+ parent::__construct($time);
// Run once per 30 minutes
$this->setInterval(60 * 30);
- if ($config === null || $expiration === null || $userManager === null) {
- $this->fixDIForJobs();
- } else {
- $this->config = $config;
- $this->userManager = $userManager;
- $this->expiration = $expiration;
- }
- }
-
- protected function fixDIForJobs() {
- /** @var Application $application */
- $application = \OC::$server->query(Application::class);
- $this->config = $application->getContainer()->get(IConfig::class);
- $this->userManager = \OC::$server->getUserManager();
- $this->expiration = $application->getContainer()->query('Expiration');
+ $this->config = $config;
+ $this->userManager = $userManager;
+ $this->expiration = $expiration;
}
/**
@@ -101,10 +85,8 @@ class ExpireTrash extends \OC\BackgroundJob\TimedJob {
/**
* Act on behalf on trash item owner
- * @param string $user
- * @return boolean
*/
- protected function setupFS($user) {
+ protected function setupFS(string $user): bool {
\OC_Util::tearDownFS();
\OC_Util::setupFS($user);