コード例 #1
0
 /**
  * @param array $argument
  * @throws \Exception
  * @throws \OC\NeedsUpdateException
  */
 protected function run($argument)
 {
     if (!isset($argument['app']) || !isset($argument['step'])) {
         // remove the job - we can never execute it
         $this->jobList->remove($this, $this->argument);
         return;
     }
     $app = $argument['app'];
     try {
         $this->loadApp($app);
     } catch (NeedsUpdateException $ex) {
         // as long as the app is not yet done with it's offline migration
         // we better not start with the live migration
         return;
     }
     $step = $argument['step'];
     $repair = new Repair([], $this->dispatcher);
     try {
         $repair->addStep($step);
     } catch (\Exception $ex) {
         $this->logger->logException($ex, ['app' => 'migration']);
         // remove the job - we can never execute it
         $this->jobList->remove($this, $this->argument);
         return;
     }
     // execute the repair step
     $repair->run();
     // remove the job once executed successfully
     $this->jobList->remove($this, $this->argument);
 }
コード例 #2
0
 /**
  * @return \OC_OCS_Result
  */
 public function disableMonthly()
 {
     $this->jobList->remove('OCA\\PopularityContestClient\\MonthlyReport');
     $notification = $this->manager->createNotification();
     $notification->setApp('popularitycontestclient');
     $this->manager->markProcessed($notification);
     return new \OC_OCS_Result();
 }
コード例 #3
0
ファイル: dropoldjobs.php プロジェクト: kenwi/core
 /**
  * Run repair step.
  * Must throw exception on error.
  *
  * @throws \Exception in case of failure
  */
 public function run()
 {
     $oldJobs = $this->oldJobs();
     foreach ($oldJobs as $job) {
         if ($this->jobList->has($job['class'], $job['arguments'])) {
             $this->jobList->remove($job['class'], $job['arguments']);
         }
     }
 }
コード例 #4
0
ファイル: OCSAuthAPI.php プロジェクト: rchicoli/owncloud-core
 /**
  * request received to ask remote server for a shared secret
  *
  * @return \OC_OCS_Result
  */
 public function requestSharedSecret()
 {
     $url = $this->request->getParam('url');
     $token = $this->request->getParam('token');
     if ($this->trustedServers->isTrustedServer($url) === false) {
         $this->logger->error('remote server not trusted (' . $url . ') while requesting shared secret', ['app' => 'federation']);
         return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
     }
     // if both server initiated the exchange of the shared secret the greater
     // token wins
     $localToken = $this->dbHandler->getToken($url);
     if (strcmp($localToken, $token) > 0) {
         $this->logger->info('remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.', ['app' => 'federation']);
         return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
     }
     // we ask for the shared secret so we no longer have to ask the other server
     // to request the shared secret
     $this->jobList->remove('OCA\\Federation\\BackgroundJob\\RequestSharedSecret', ['url' => $url, 'token' => $localToken]);
     $this->jobList->add('OCA\\Federation\\BackgroundJob\\GetSharedSecret', ['url' => $url, 'token' => $token]);
     return new \OC_OCS_Result(null, Http::STATUS_OK);
 }