summaryrefslogtreecommitdiffstats
path: root/apps/lookup_server_connector
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-06-28 12:55:26 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-08-08 17:03:19 +0200
commit48d9c4d2b093e12ec3bf3cd29295da0f2277028f (patch)
treed66f1d2f54e8ae745fc7ce7bf067ce2072eeac6a /apps/lookup_server_connector
parent19a2d6f6e7d54eb9318279809bf6c3f40bf566e2 (diff)
downloadnextcloud-server-48d9c4d2b093e12ec3bf3cd29295da0f2277028f.tar.gz
nextcloud-server-48d9c4d2b093e12ec3bf3cd29295da0f2277028f.zip
Port existing server code to new interface
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/lookup_server_connector')
-rw-r--r--apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php37
1 files changed, 12 insertions, 25 deletions
diff --git a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php
index f905f9173b6..39d8118abe7 100644
--- a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php
+++ b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php
@@ -44,22 +44,14 @@ use OCP\IUser;
use OCP\IUserManager;
class RetryJob extends Job {
- /** @var IClientService */
- private $clientService;
- /** @var string */
- private $lookupServer;
- /** @var IConfig */
- private $config;
- /** @var IUserManager */
- private $userManager;
- /** @var IAccountManager */
- private $accountManager;
- /** @var Signer */
- private $signer;
- /** @var int */
- protected $retries = 0;
- /** @var bool */
- protected $retainJob = false;
+ private IClientService $clientService;
+ private string $lookupServer;
+ private IConfig $config;
+ private IUserManager $userManager;
+ private IAccountManager $accountManager;
+ private Signer $signer;
+ protected int $retries = 0;
+ protected bool $retainJob = false;
/**
* @param ITimeFactory $time
@@ -90,19 +82,16 @@ class RetryJob extends Job {
}
/**
- * run the job, then remove it from the jobList
- *
- * @param IJobList $jobList
- * @param ILogger|null $logger
+ * Run the job, then remove it from the jobList
*/
- public function execute(IJobList $jobList, ILogger $logger = null): void {
+ public function start(IJobList $jobList): void {
if (!isset($this->argument['userId'])) {
// Old background job without user id, just drop it.
$jobList->remove($this, $this->argument);
return;
}
- $this->retries = (int) $this->config->getUserValue($this->argument['userId'], 'lookup_server_connector', 'update_retries', 0);
+ $this->retries = (int) $this->config->getUserValue($this->argument['userId'], 'lookup_server_connector', 'update_retries', '0');
if ($this->shouldRemoveBackgroundJob()) {
$jobList->remove($this, $this->argument);
@@ -110,7 +99,7 @@ class RetryJob extends Job {
}
if ($this->shouldRun()) {
- parent::execute($jobList, $logger);
+ parent::start($jobList);
if (!$this->retainJob) {
$jobList->remove($this, $this->argument);
}
@@ -124,8 +113,6 @@ class RetryJob extends Job {
* - no valid lookup server URL given
* - lookup server was disabled by the admin
* - max retries are reached (set to 5)
- *
- * @return bool
*/
protected function shouldRemoveBackgroundJob(): bool {
return $this->config->getSystemValueBool('has_internet_connection', true) === false ||