aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-12-05 10:13:34 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-12-05 10:13:34 +0100
commita0f6a6545b59b1061e96e7d17d8ec6d6f32e615e (patch)
treeb98e1679b900f1518acdcea69884c25f1cd0f962
parent944be7950a0199dbc48b99dac936987b13dd0383 (diff)
downloadnextcloud-server-a0f6a6545b59b1061e96e7d17d8ec6d6f32e615e.tar.gz
nextcloud-server-a0f6a6545b59b1061e96e7d17d8ec6d6f32e615e.zip
Use TimedJob from OCP instead of OC
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--apps/admin_audit/lib/BackgroundJobs/Rotate.php10
-rw-r--r--apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php15
-rw-r--r--apps/files/lib/BackgroundJob/CleanupFileLocks.php8
-rw-r--r--apps/files/lib/BackgroundJob/DeleteOrphanedItems.php6
-rw-r--r--apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php7
-rw-r--r--apps/files_sharing/lib/DeleteOrphanedSharesJob.php8
-rw-r--r--apps/updatenotification/lib/Notification/BackgroundJob.php7
-rw-r--r--apps/user_ldap/lib/Jobs/CleanUp.php10
-rw-r--r--apps/workflowengine/lib/BackgroundJobs/Rotate.php6
-rw-r--r--lib/private/Preview/BackgroundCleanupJob.php8
10 files changed, 57 insertions, 28 deletions
diff --git a/apps/admin_audit/lib/BackgroundJobs/Rotate.php b/apps/admin_audit/lib/BackgroundJobs/Rotate.php
index 27d5109fd3f..9526be6f7b1 100644
--- a/apps/admin_audit/lib/BackgroundJobs/Rotate.php
+++ b/apps/admin_audit/lib/BackgroundJobs/Rotate.php
@@ -27,7 +27,8 @@ declare(strict_types=1);
*/
namespace OCA\AdminAudit\BackgroundJobs;
-use OC\BackgroundJob\TimedJob;
+use OCP\BackgroundJob\TimedJob;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig;
use OCP\Log\RotationTrait;
@@ -37,13 +38,16 @@ class Rotate extends TimedJob {
/** @var IConfig */
private $config;
- public function __construct(IConfig $config) {
+ public function __construct(ITimeFactory $time,
+ IConfig $config) {
+ parent::__construct($time);
+
$this->config = $config;
$this->setInterval(60 * 60 * 3);
}
- protected function run($argument) {
+ protected function run($argument): void {
$default = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log';
$this->filePath = $this->config->getAppValue('admin_audit', 'logfile', $default);
diff --git a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php
index 16f76a76dd8..a9b5b1446b2 100644
--- a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php
+++ b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
*
@@ -23,18 +26,18 @@
*/
namespace OCA\Files\BackgroundJob;
-use OC\BackgroundJob\TimedJob;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OCP\DirectEditing\IManager;
class CleanupDirectEditingTokens extends TimedJob {
private const INTERVAL_MINUTES = 15 * 60;
- /**
- * @var IManager
- */
- private $manager;
+ private IManager $manager;
- public function __construct(IManager $manager) {
+ public function __construct(ITimeFactory $time,
+ IManager $manager) {
+ parent::__construct($time);
$this->interval = self::INTERVAL_MINUTES;
$this->manager = $manager;
}
diff --git a/apps/files/lib/BackgroundJob/CleanupFileLocks.php b/apps/files/lib/BackgroundJob/CleanupFileLocks.php
index f22b8edcd9b..e0ad72eaaf0 100644
--- a/apps/files/lib/BackgroundJob/CleanupFileLocks.php
+++ b/apps/files/lib/BackgroundJob/CleanupFileLocks.php
@@ -23,14 +23,14 @@
*/
namespace OCA\Files\BackgroundJob;
-use OC\BackgroundJob\TimedJob;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OC\Lock\DBLockingProvider;
/**
* Clean up all file locks that are expired for the DB file locking provider
*/
class CleanupFileLocks extends TimedJob {
-
/**
* Default interval in minutes
*
@@ -41,7 +41,9 @@ class CleanupFileLocks extends TimedJob {
/**
* sets the correct interval for this timed job
*/
- public function __construct() {
+ public function __construct(ITimeFactory $time) {
+ parent::__construct($time);
+
$this->interval = $this->defaultIntervalMin * 60;
}
diff --git a/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php b/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php
index 720785f5727..669c2a4cde6 100644
--- a/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php
+++ b/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php
@@ -24,7 +24,8 @@
*/
namespace OCA\Files\BackgroundJob;
-use OC\BackgroundJob\TimedJob;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OCP\DB\QueryBuilder\IQueryBuilder;
/**
@@ -49,7 +50,8 @@ class DeleteOrphanedItems extends TimedJob {
/**
* sets the correct interval for this timed job
*/
- public function __construct() {
+ public function __construct(ITimeFactory $time) {
+ parent::__construct($time);
$this->interval = $this->defaultIntervalMin * 60;
$this->connection = \OC::$server->getDatabaseConnection();
$this->logger = \OC::$server->getLogger();
diff --git a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php
index d35f35d20f2..687dcd25f8b 100644
--- a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php
+++ b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php
@@ -26,7 +26,8 @@ declare(strict_types=1);
*/
namespace OCA\Files_Sharing\BackgroundJob;
-use OC\BackgroundJob\TimedJob;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OCP\IDBConnection;
use OCP\OCS\IDiscoveryService;
@@ -36,8 +37,10 @@ class FederatedSharesDiscoverJob extends TimedJob {
/** @var IDiscoveryService */
private $discoveryService;
- public function __construct(IDBConnection $connection,
+ public function __construct(ITimeFactory $time,
+ IDBConnection $connection,
IDiscoveryService $discoveryService) {
+ parent::__construct($time);
$this->connection = $connection;
$this->discoveryService = $discoveryService;
diff --git a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php
index 6a641734680..d2cc39ff060 100644
--- a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php
+++ b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php
@@ -24,13 +24,13 @@
*/
namespace OCA\Files_Sharing;
-use OC\BackgroundJob\TimedJob;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
/**
* Delete all share entries that have no matching entries in the file cache table.
*/
class DeleteOrphanedSharesJob extends TimedJob {
-
/**
* Default interval in minutes
*
@@ -41,7 +41,9 @@ class DeleteOrphanedSharesJob extends TimedJob {
/**
* sets the correct interval for this timed job
*/
- public function __construct() {
+ public function __construct(ITimeFactory $time) {
+ parent::__construct($time);
+
$this->interval = $this->defaultIntervalMin * 60;
}
diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php
index e7dc193df6c..c1b3cddf945 100644
--- a/apps/updatenotification/lib/Notification/BackgroundJob.php
+++ b/apps/updatenotification/lib/Notification/BackgroundJob.php
@@ -26,10 +26,11 @@ declare(strict_types=1);
*/
namespace OCA\UpdateNotification\Notification;
-use OC\BackgroundJob\TimedJob;
use OC\Installer;
use OC\Updater\VersionCheck;
use OCP\App\IAppManager;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\IGroup;
@@ -60,12 +61,14 @@ class BackgroundJob extends TimedJob {
/** @var string[] */
protected $users;
- public function __construct(IConfig $config,
+ public function __construct(ITimeFactory $timeFactory,
+ IConfig $config,
IManager $notificationManager,
IGroupManager $groupManager,
IAppManager $appManager,
IClientService $client,
Installer $installer) {
+ parent::__construct($timeFactory);
// Run once a day
$this->setInterval(60 * 60 * 24);
diff --git a/apps/user_ldap/lib/Jobs/CleanUp.php b/apps/user_ldap/lib/Jobs/CleanUp.php
index 22067d81a9d..be7c09bd961 100644
--- a/apps/user_ldap/lib/Jobs/CleanUp.php
+++ b/apps/user_ldap/lib/Jobs/CleanUp.php
@@ -25,7 +25,8 @@
*/
namespace OCA\User_LDAP\Jobs;
-use OC\BackgroundJob\TimedJob;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OCA\User_LDAP\Helper;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\User\DeletedUsersIndex;
@@ -64,7 +65,12 @@ class CleanUp extends TimedJob {
/** @var DeletedUsersIndex */
protected $dui;
- public function __construct(User_Proxy $userBackend, DeletedUsersIndex $dui) {
+ public function __construct(
+ ITimeFactory $timeFactory,
+ User_Proxy $userBackend,
+ DeletedUsersIndex $dui
+ ) {
+ parent::__construct($timeFactory);
$minutes = \OC::$server->getConfig()->getSystemValue(
'ldapUserCleanupInterval', (string)$this->defaultIntervalMin);
$this->setInterval((int)$minutes * 60);
diff --git a/apps/workflowengine/lib/BackgroundJobs/Rotate.php b/apps/workflowengine/lib/BackgroundJobs/Rotate.php
index e96af4fd9e1..ee83f4821f1 100644
--- a/apps/workflowengine/lib/BackgroundJobs/Rotate.php
+++ b/apps/workflowengine/lib/BackgroundJobs/Rotate.php
@@ -23,14 +23,16 @@
*/
namespace OCA\WorkflowEngine\BackgroundJobs;
-use OC\BackgroundJob\TimedJob;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OCA\WorkflowEngine\AppInfo\Application;
use OCP\Log\RotationTrait;
class Rotate extends TimedJob {
use RotationTrait;
- public function __construct() {
+ public function __construct(ITimeFactory $time) {
+ parent::__construct($time);
$this->setInterval(60 * 60 * 3);
}
diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php
index ab40aeaaa79..9a493384f11 100644
--- a/lib/private/Preview/BackgroundCleanupJob.php
+++ b/lib/private/Preview/BackgroundCleanupJob.php
@@ -25,8 +25,9 @@ declare(strict_types=1);
*/
namespace OC\Preview;
-use OC\BackgroundJob\TimedJob;
use OC\Preview\Storage\Root;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\IMimeTypeLoader;
use OCP\Files\NotFoundException;
@@ -34,7 +35,6 @@ use OCP\Files\NotPermittedException;
use OCP\IDBConnection;
class BackgroundCleanupJob extends TimedJob {
-
/** @var IDBConnection */
private $connection;
@@ -47,10 +47,12 @@ class BackgroundCleanupJob extends TimedJob {
/** @var IMimeTypeLoader */
private $mimeTypeLoader;
- public function __construct(IDBConnection $connection,
+ public function __construct(ITimeFactory $timeFactory,
+ IDBConnection $connection,
Root $previewFolder,
IMimeTypeLoader $mimeTypeLoader,
bool $isCLI) {
+ parent::__construct($timeFactory);
// Run at most once an hour
$this->setInterval(3600);