/** * get the execution type of background jobs * * @return string * * This method returns the type how background jobs are executed. If the user * did not select something, the type is ajax. */ public static function getExecutionType() { return \OC_BackgroundJob::getExecutionType(); }
} // load all apps to get all api routes properly setup OC_App::loadApps(); \OC::$server->getSession()->close(); // initialize a dummy memory session \OC::$server->setSession(new \OC\Session\Memory('')); $logger = \OC_Log::$object; // Don't do anything if ownCloud has not been installed if (!OC_Config::getValue('installed', false)) { exit(0); } // Handle unexpected errors register_shutdown_function('handleUnexpectedShutdown'); \OC::$server->getTempManager()->cleanOld(); // Exit if background jobs are disabled! $appmode = OC_BackgroundJob::getExecutionType(); if ($appmode == 'none') { TemporaryCronClass::$sent = true; if (OC::$CLI) { echo 'Background Jobs are disabled!' . PHP_EOL; } else { OC_JSON::error(array('data' => array('message' => 'Background jobs disabled!'))); } exit(1); } if (OC::$CLI) { // Create lock file first TemporaryCronClass::$lockfile = OC_Config::getValue("datadirectory", OC::$SERVERROOT . '/data') . '/cron.lock'; // We call ownCloud from the CLI (aka cron) if ($appmode != 'cron') { // Use cron in future!
/** * * @return boolean */ public function isCronEnabled() { return \OC_BackgroundJob::getExecutionType() == 'cron'; }