コード例 #1
0
 /**
  * run the job, then remove it from the joblist
  *
  * @param JobList $jobList
  * @param ILogger $logger
  */
 public function execute($jobList, ILogger $logger = null)
 {
     $jobList->remove($this, $this->argument);
     $target = $this->argument['url'];
     // only execute if target is still in the list of trusted domains
     if ($this->trustedServers->isTrustedServer($target)) {
         $this->parentExecute($jobList, $logger);
     }
 }
コード例 #2
0
ファイル: Job.php プロジェクト: GitHubUser4234/core
 /**
  * @param JobList $jobList
  * @param ILogger $logger
  */
 public function execute($jobList, ILogger $logger = null)
 {
     $jobList->setLastRun($this);
     try {
         $this->run($this->argument);
     } catch (\Exception $e) {
         if ($logger) {
             $logger->logException($e, ['app' => 'core', 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')']);
         }
     }
 }
コード例 #3
0
ファイル: job.php プロジェクト: Angelos0/core
 /**
  * @param JobList $jobList
  * @param ILogger $logger
  */
 public function execute($jobList, ILogger $logger = null)
 {
     $jobList->setLastRun($this);
     try {
         $this->run($this->argument);
     } catch (\Exception $e) {
         if ($logger) {
             $logger->error('Error while running background job: ' . $e->getMessage());
         }
     }
 }
コード例 #4
0
 public function testSetLastRun()
 {
     $job = new TestJob();
     $this->instance->add($job);
     $jobs = $this->getAllSorted();
     $addedJob = $jobs[count($jobs) - 1];
     $timeStart = time();
     $this->instance->setLastRun($addedJob);
     $timeEnd = time();
     $addedJob = $this->instance->getById($addedJob->getId());
     $this->assertGreaterThanOrEqual($timeStart, $addedJob->getLastRun());
     $this->assertLessThanOrEqual($timeEnd, $addedJob->getLastRun());
 }
コード例 #5
0
ファイル: joblist.php プロジェクト: TechArea/core
 public function testGetNextNonExisting()
 {
     $job = new TestJob();
     $this->instance->add($job, 1);
     $this->instance->add('\\OC\\Non\\Existing\\Class');
     $this->instance->add($job, 2);
     $jobs = $this->getAllSorted();
     $savedJob1 = $jobs[count($jobs) - 2];
     $savedJob2 = $jobs[count($jobs) - 1];
     $this->config->expects($this->any())->method('getAppValue')->with('backgroundjob', 'lastjob', 0)->will($this->returnValue($savedJob1->getId()));
     $this->instance->getNext();
     $nextJob = $this->instance->getNext();
     $this->assertEquals($savedJob2, $nextJob);
     $this->instance->remove($job, 1);
     $this->instance->remove($job, 2);
 }
コード例 #6
0
 /**
  * @deprecated
  * deletes a queued task
  * @param int $id id of task
  * @return bool
  *
  * Deletes a report
  */
 public static function deleteQueuedTask($id)
 {
     $jobList = new JobList();
     $job = $jobList->getById($id);
     if ($job) {
         $jobList->remove($job);
     }
 }
コード例 #7
0
ファイル: QueuedJob.php プロジェクト: GitHubUser4234/core
 /**
  * run the job, then remove it from the joblist
  *
  * @param JobList $jobList
  * @param ILogger $logger
  */
 public function execute($jobList, ILogger $logger = null)
 {
     $jobList->remove($this, $this->argument);
     parent::execute($jobList, $logger);
 }