diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-11 22:25:07 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-11 22:25:07 +0200 |
commit | cd53498256c8d600821a55180c75564bcc63a364 (patch) | |
tree | 01ad255ce09a51f1e7aafd370b28b4568d627c8a /apps | |
parent | 8d17d7f6cd1027a96586a25ae5a583ec50d56797 (diff) | |
download | nextcloud-server-cd53498256c8d600821a55180c75564bcc63a364.tar.gz nextcloud-server-cd53498256c8d600821a55180c75564bcc63a364.zip |
Use more magic DI in files_versions
There is no need to register this. The system can figure out by itself
what it needs to do :)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_versions/lib/AppInfo/Application.php | 10 | ||||
-rw-r--r-- | apps/files_versions/lib/BackgroundJob/ExpireVersions.php | 16 | ||||
-rw-r--r-- | apps/files_versions/lib/Command/ExpireVersions.php | 8 | ||||
-rw-r--r-- | apps/files_versions/lib/Storage.php | 2 |
4 files changed, 8 insertions, 28 deletions
diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php index 4431fbf51bf..be80f7d853b 100644 --- a/apps/files_versions/lib/AppInfo/Application.php +++ b/apps/files_versions/lib/AppInfo/Application.php @@ -41,16 +41,6 @@ class Application extends App { $container->registerCapability(Capabilities::class); /* - * Register expiration - */ - $container->registerService('Expiration', function($c) { - return new Expiration( - $c->query('ServerContainer')->getConfig(), - $c->query(ITimeFactory::class) - ); - }); - - /* * Register $principalBackend for the DAV collection */ $container->registerService('principalBackend', function () { diff --git a/apps/files_versions/lib/BackgroundJob/ExpireVersions.php b/apps/files_versions/lib/BackgroundJob/ExpireVersions.php index d69e5bb87ce..47a1903a535 100644 --- a/apps/files_versions/lib/BackgroundJob/ExpireVersions.php +++ b/apps/files_versions/lib/BackgroundJob/ExpireVersions.php @@ -44,22 +44,12 @@ class ExpireVersions extends \OC\BackgroundJob\TimedJob { */ private $userManager; - public function __construct(IUserManager $userManager = null, Expiration $expiration = null) { + public function __construct(IUserManager $userManager, Expiration $expiration) { // Run once per 30 minutes $this->setInterval(60 * 30); - if (is_null($expiration) || is_null($userManager)) { - $this->fixDIForJobs(); - } else { - $this->expiration = $expiration; - $this->userManager = $userManager; - } - } - - protected function fixDIForJobs() { - $application = new Application(); - $this->expiration = $application->getContainer()->query('Expiration'); - $this->userManager = \OC::$server->getUserManager(); + $this->expiration = $expiration; + $this->userManager = $userManager; } protected function run($argument) { diff --git a/apps/files_versions/lib/Command/ExpireVersions.php b/apps/files_versions/lib/Command/ExpireVersions.php index 09de0ad6d90..7fdaa27afd9 100644 --- a/apps/files_versions/lib/Command/ExpireVersions.php +++ b/apps/files_versions/lib/Command/ExpireVersions.php @@ -46,11 +46,11 @@ class ExpireVersions extends Command { private $userManager; /** - * @param IUserManager|null $userManager - * @param Expiration|null $expiration + * @param IUserManager $userManager + * @param Expiration $expiration */ - public function __construct(IUserManager $userManager = null, - Expiration $expiration = null) { + public function __construct(IUserManager $userManager, + Expiration $expiration) { parent::__construct(); $this->userManager = $userManager; diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 52afdfdaa5a..217bf02fd39 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -845,7 +845,7 @@ class Storage { if (is_null(self::$application)) { self::$application = new Application(); } - return self::$application->getContainer()->query('Expiration'); + return self::$application->getContainer()->query(Expiration::class); } } |