Skip to content
Snippets Groups Projects
Commit f8c04a42 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #24392 from owncloud/declare-cron-jobs-in-info.xml

Declare cron jobs in info.xml
parents 15a479fb cc1d948c
No related branches found
No related tags found
No related merge requests found
......@@ -153,11 +153,6 @@ class Application extends App {
return $this->getContainer()->query('SyncService');
}
public function setupCron() {
$jl = $this->getContainer()->getServer()->getJobList();
$jl->add(new SyncJob());
}
public function generateBirthdays() {
try {
/** @var BirthdayService $migration */
......
......@@ -16,4 +16,7 @@
<dependencies>
<owncloud min-version="9.1" max-version="9.1" />
</dependencies>
<background-jobs>
<job>OCA\DAV\CardDAV\Sync\SyncJob</job>
</background-jobs>
</info>
......@@ -22,5 +22,4 @@
use OCA\Dav\AppInfo\Application;
$app = new Application();
$app->setupCron();
$app->generateBirthdays();
......@@ -22,5 +22,4 @@
use OCA\Dav\AppInfo\Application;
$app = new Application();
$app->setupCron();
$app->generateBirthdays();
......@@ -89,6 +89,9 @@ class InfoParser {
if (!array_key_exists('uninstall', $array['repair-steps'])) {
$array['repair-steps']['uninstall'] = [];
}
if (!array_key_exists('background-jobs', $array)) {
$array['background-jobs'] = [];
}
if (array_key_exists('documentation', $array) && is_array($array['documentation'])) {
foreach ($array['documentation'] as $key => $url) {
......@@ -128,6 +131,9 @@ class InfoParser {
if (isset($array['repair-steps']['uninstall']['step']) && is_array($array['repair-steps']['uninstall']['step'])) {
$array['repair-steps']['uninstall'] = $array['repair-steps']['uninstall']['step'];
}
if (isset($array['background-jobs']['job']) && is_array($array['background-jobs']['job'])) {
$array['background-jobs'] = $array['background-jobs']['job'];
}
return $array;
}
......@@ -147,10 +153,7 @@ class InfoParser {
if (!isset($array[$element])) {
$array[$element] = "";
}
/**
* @var \SimpleXMLElement $node
*/
/** @var \SimpleXMLElement $node */
// Has attributes
if ($attributes = $node->attributes()) {
$data = [
......
......@@ -133,6 +133,8 @@ class Installer {
}
}
\OC_App::setupBackgroundJobs($info['background-jobs']);
//run appinfo/install.php
if((!isset($data['noinstall']) or $data['noinstall']==false)) {
self::includeAppScript($basedir . '/appinfo/install.php');
......@@ -569,6 +571,7 @@ class Installer {
if (is_null($info)) {
return false;
}
\OC_App::setupBackgroundJobs($info['background-jobs']);
OC_App::executeRepairSteps($app, $info['repair-steps']['install']);
......
......@@ -1190,6 +1190,7 @@ class OC_App {
self::loadApp($appId, false);
include $appPath . '/appinfo/update.php';
}
self::setupBackgroundJobs($appData['background-jobs']);
//set remote/public handlers
if (array_key_exists('ocsid', $appData)) {
......@@ -1240,6 +1241,13 @@ class OC_App {
$r->run();
}
public static function setupBackgroundJobs(array $jobs) {
$queue = \OC::$server->getJobList();
foreach ($jobs as $job) {
$queue->add($job);
}
}
/**
* @param string $appId
* @param string[] $steps
......
......@@ -74,5 +74,6 @@
"post-migration": [],
"live-migration": [],
"uninstall": []
}
},
"background-jobs": []
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment