<?php /** * Copyright (c) 2014 Victor Dubiniuk <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ $installedVersion = \OCP\Config::getAppValue('files_antivirus', 'installed_version'); if (version_compare($installedVersion, '0.5', '<')) { \OCA\Files_Antivirus\Status::init(); } if (version_compare($installedVersion, '0.6', '<')) { // remove the old job with old classname $jobList = new \OC\BackgroundJob\JobList(); $jobs = $jobList->getAll(); foreach ($jobs as $job) { $jobArg = $job->getArgument(); if ($jobArg[0] == 'OC_Files_Antivirus_BackgroundScanner') { $jobList->remove($job); } } }
echo "Another instance of cron.php is still running!"; exit(1); } // Create a lock file touch(TemporaryCronClass::$lockfile); // Work $jobList = new \OC\BackgroundJob\JobList(); $jobs = $jobList->getAll(); foreach ($jobs as $job) { $job->execute($jobList, $logger); } } else { // We call cron.php from some website if ($appmode == 'cron') { // Cron is cron :-P OC_JSON::error(array('data' => array('message' => 'Backgroundjobs are using system cron!'))); } else { // Work and success :-) $jobList = new \OC\BackgroundJob\JobList(); $job = $jobList->getNext(); $job->execute($jobList, $logger); $jobList->setLastJob($job); OC_JSON::success(); } } // done! TemporaryCronClass::$sent = true; exit; } catch (Exception $ex) { \OCP\Util::writeLog('cron', $ex->getMessage(), \OCP\Util::FATAL); }