config = $config; $this->jobList = $jobList; } /** * Add a job to list * * @param IJob|string $job */ private function addJob($job) { if (!$this->jobList->has($job, null)) { $this->jobList->add($job); \OCP\Log\logger('onlyoffice')->debug("Job '".$job."' added to JobList.", ["app" => $this->appName]); } } /** * Remove a job from list * * @param IJob|string $job */ private function removeJob($job) { if ($this->jobList->has($job, null)) { $this->jobList->remove($job); \OCP\Log\logger('onlyoffice')->debug("Job '".$job."' removed from JobList.", ["app" => $this->appName]); } } /** * Add or remove EditorsCheck job depending on the value of _editors_check_interval * */ private function checkEditorsCheckJob() { if (!$this->config->getCronChecker()) { $this->removeJob(EditorsCheck::class); return; } if ($this->config->getEditorsCheckInterval() > 0) { $this->addJob(EditorsCheck::class); } else { $this->removeJob(EditorsCheck::class); } } /** * Method for sequentially calling checks of all jobs * */ public function checkAllJobs() { $this->checkEditorsCheckJob(); } }