ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCronManager Class Reference

Cron management. More...

+ Collaboration diagram for ilCronManager:

Static Public Member Functions

static runActiveJobs ()
 Run all active jobs.
static runJobManual ($a_job_id)
 Run single job manually.
static getJobInstanceById ($a_job_id)
 Get job instance (by job id)
static getJobInstance ($a_id, $a_component, $a_class, $a_path=null)
 Get job instance (by job data)
static createDefaultEntry (ilCronJob $a_job, $a_component, $a_class, $a_path)
static updateFromXML ($a_component, $a_id, $a_class, $a_path=null)
 Process data from module.xml/service.xml.
static clearFromXML ($a_component, array $a_xml_job_ids)
 Clear job data.
static getPluginJobs ($a_only_active=false)
static getCronJobData ($a_id=null, $a_include_inactive=true)
 Get cron job configuration/execution data.
static resetJob (ilCronJob $a_job)
 Reset job.
static activateJob (ilCronJob $a_job, $a_manual=false)
 Activate cron job.
static deactivateJob (ilCronJob $a_job, $a_manual=false)
 Deactivate cron job.
static isJobActive ($a_job_id)
 Check if given job is currently active.
static isJobInactive ($a_job_id)
 Check if given job is currently inactive.
static updateJobSchedule (ilCronJob $a_job, $a_schedule_type, $a_schedule_value)
 Update job schedule.
static ping ($a_job_id)
 Keep cron job alive.

Static Protected Member Functions

static runJob (ilCronJob $a_job, array $a_job_data, $a_manual=false)
 Run single cron job (internal)
static sendNotification (ilCronJob $a_job, $a_message)
 Send notification to admin about job event(s)
static updateJobResult (ilCronJob $a_job, ilCronJobResult $a_result, $a_manual=false)
 Save job result.
static getMicrotime ()
 Get current microtime.

Detailed Description

Cron management.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 11 of file class.ilCronManager.php.

Member Function Documentation

static ilCronManager::activateJob ( ilCronJob  $a_job,
  $a_manual = false 
)
static

Activate cron job.

Parameters
ilCronJob$a_job
bool$a_manual

Definition at line 573 of file class.ilCronManager.php.

References $ilDB, $ilUser, ilCronJob\activationWasToggled(), and ilCronJob\getId().

Referenced by ilCronManagerGUI\confirmedActivate(), createDefaultEntry(), and resetJob().

{
global $ilDB, $ilUser;
$user_id = $a_manual ? $ilUser->getId() : 0;
$sql = "UPDATE cron_job SET ".
" job_status = ".$ilDB->quote(1, "integer").
" , job_status_user_id = ".$ilDB->quote($user_id, "integer").
" , job_status_type = ".$ilDB->quote($a_manual, "integer").
" , job_status_ts = ".$ilDB->quote(time(), "integer").
" WHERE job_id = ".$ilDB->quote($a_job->getId(), "text");
$ilDB->manipulate($sql);
$a_job->activationWasToggled(true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::clearFromXML (   $a_component,
array  $a_xml_job_ids 
)
static

Clear job data.

Parameters
string$a_component
array$a_xml_job_ids

Definition at line 413 of file class.ilCronManager.php.

References $ilDB, $ilLog, and $row.

Referenced by ilObjDefReader\handlerEndTag().

{
global $ilDB, $ilLog;
if(!$ilDB->tableExists("cron_job"))
{
return;
}
// gather existing jobs
$all_jobs = array();
$sql = "SELECT job_id FROM cron_job".
" WHERE component = ".$ilDB->quote($a_component, "text");
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$all_jobs[] = $row["job_id"];
}
if(sizeof($all_jobs))
{
if(sizeof($a_xml_job_ids))
{
// delete obsolete job data
foreach($all_jobs as $job_id)
{
if(!in_array($job_id, $a_xml_job_ids))
{
$ilDB->manipulate("DELETE FROM cron_job".
" WHERE component = ".$ilDB->quote($a_component, "text").
" AND job_id = ".$ilDB->quote($job_id, "text"));
$ilLog->write("Cron XML - Job ".$job_id." in class ".$a_component.
" deleted.");
}
}
}
else
{
$ilDB->manipulate("DELETE FROM cron_job".
" WHERE component = ".$ilDB->quote($a_component, "text"));
$ilLog->write("Cron XML - All jobs deleted for ".$a_component." as component is inactive.");
}
}
}

+ Here is the caller graph for this function:

static ilCronManager::createDefaultEntry ( ilCronJob  $a_job,
  $a_component,
  $a_class,
  $a_path 
)
static

Definition at line 320 of file class.ilCronManager.php.

References $ilDB, $ilLog, $ilSetting, $row, activateJob(), ilCronJob\activationWasToggled(), ilCronJob\getDefaultScheduleType(), ilCronJob\getDefaultScheduleValue(), ilCronJob\getId(), ilCronJob\hasAutoActivation(), ilCronJob\hasFlexibleSchedule(), and updateJobSchedule().

Referenced by getJobInstanceById(), getPluginJobs(), and updateFromXML().

{
// already exists?
$sql = "SELECT job_id, schedule_type FROM cron_job".
" WHERE component = ".$ilDB->quote($a_component, "text").
" AND job_id = ".$ilDB->quote($a_job->getId(), "text");
$set = $ilDB->query($sql);
$row = $ilDB->fetchAssoc($set);
$job_exists = ($row["job_id"] == $a_job->getId());
$schedule_type = $row["schedule_type"];
// new job
if(!$job_exists)
{
$sql = "INSERT INTO cron_job (job_id, component, class, path)".
" VALUES (".$ilDB->quote($a_job->getId(), "text").", ".
$ilDB->quote($a_component, "text").", ".
$ilDB->quote($a_class, "text").", ".
$ilDB->quote($a_path, "text").")";
$ilDB->manipulate($sql);
$ilLog->write("Cron XML - Job ".$a_job->getId()." in class ".$a_class.
" added.");
// only if flexible
// #12221
if(!is_object($ilSetting))
{
include_once "Services/Administration/classes/class.ilSetting.php";
$ilSetting = new ilSetting();
}
if($a_job->hasAutoActivation())
{
}
else
{
// to overwrite dependent settings
$a_job->activationWasToggled(false);
}
}
// existing job - but schedule is flexible now
else if($a_job->hasFlexibleSchedule() && !$schedule_type)
{
}
// existing job - but schedule is static now
else if(!$a_job->hasFlexibleSchedule() && $schedule_type)
{
self::updateJobSchedule($a_job, null, null);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::deactivateJob ( ilCronJob  $a_job,
  $a_manual = false 
)
static

Deactivate cron job.

Parameters
ilCronJob$a_job
bool$a_manual

Definition at line 596 of file class.ilCronManager.php.

References $ilDB, $ilUser, ilCronJob\activationWasToggled(), and ilCronJob\getId().

Referenced by ilCronManagerGUI\confirmedDeactivate(), and runJob().

{
global $ilDB, $ilUser;
$user_id = $a_manual ? $ilUser->getId() : 0;
$sql = "UPDATE cron_job SET ".
" job_status = ".$ilDB->quote(0, "integer").
" , job_status_user_id = ".$ilDB->quote($user_id, "integer").
" , job_status_type = ".$ilDB->quote($a_manual, "integer").
" , job_status_ts = ".$ilDB->quote(time(), "integer").
" WHERE job_id = ".$ilDB->quote($a_job->getId(), "text");
$ilDB->manipulate($sql);
$a_job->activationWasToggled(false);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::getCronJobData (   $a_id = null,
  $a_include_inactive = true 
)
static

Get cron job configuration/execution data.

Parameters
array | string$a_id
array$a_include_inactive
Returns
array

Definition at line 499 of file class.ilCronManager.php.

References $ilDB, $res, $row, and IL_COMP_PLUGIN.

Referenced by ilCronManagerGUI\addToExternalSettingsForm(), ilCronDeleteInactiveUserAccounts\calculateDeletionData(), ilCronManagerTableGUI\getItems(), getJobInstanceById(), getPluginJobs(), ilCronManagerGUI\initEditForm(), isJobActive(), and isJobInactive().

{
global $ilDB;
$res = array();
if($a_id && !is_array($a_id))
{
$a_id = array($a_id);
}
$sql = "SELECT * FROM cron_job";
$where = array();
if($a_id)
{
$where[] = $ilDB->in("job_id", $a_id, "", "text");
}
else
{
$where[] = "class <> ".$ilDB->quote(IL_COMP_PLUGIN, "text");
}
if(!$a_include_inactive)
{
$where[] = "job_status = ".$ilDB->quote(1, "integer");
}
if(sizeof($where))
{
$sql .= " WHERE ".implode(" AND ", $where);
}
// :TODO: discuss job execution order
$sql .= " ORDER BY job_id";
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$res[] = $row;
}
return $res;
}

+ Here is the caller graph for this function:

static ilCronManager::getJobInstance (   $a_id,
  $a_component,
  $a_class,
  $a_path = null 
)
static

Get job instance (by job data)

Parameters
string$a_component
string$a_class
string$a_path
Returns
ilCronJob

Definition at line 264 of file class.ilCronManager.php.

References $ilLog.

Referenced by ilCronManagerGUI\addToExternalSettingsForm(), ilCronManagerTableGUI\getItems(), getJobInstanceById(), and updateFromXML().

{
global $ilLog;
if(!$a_path)
{
$a_path = $a_component."/classes/";
}
$class_file = $a_path."class.".$a_class.".php";
if(file_exists($class_file))
{
include_once $class_file;
if(class_exists($a_class))
{
$job = new $a_class();
if($job instanceof ilCronJob)
{
if($job->getId() == $a_id)
{
return $job;
}
else
{
$mess .= " - job id mismatch";
}
}
else
{
$mess .= " - does not extend ilCronJob";
}
}
else
{
$mess = "- class not found in file";
}
}
else
{
$mess = " - class file not found";
}
$ilLog->write("Cron XML - Job ".$a_id." in class ".$a_class." (".
$class_file.") is invalid.".$mess);
}

+ Here is the caller graph for this function:

static ilCronManager::getJobInstanceById (   $a_job_id)
static

Get job instance (by job id)

Parameters
string$a_job_id
Returns
ilCronJob

Definition at line 213 of file class.ilCronManager.php.

References $ilLog, createDefaultEntry(), getCronJobData(), getJobInstance(), IL_COMP_PLUGIN, and IL_COMP_SERVICE.

Referenced by ilCronManagerGUI\confirmedReset(), ilCronManagerGUI\getMultiActionData(), ilCronManagerGUI\initEditForm(), runActiveJobs(), runJobManual(), and ilCronManagerGUI\update().

{
global $ilLog, $ilPluginAdmin;
// plugin
if(substr($a_job_id, 0, 4) == "pl__")
{
$parts = explode("__", $a_job_id);
$pl_name = $parts[1];
$job_id = $parts[2];
if($ilPluginAdmin->isActive(IL_COMP_SERVICE, "Cron", "crnhk", $pl_name))
{
$plugin_obj = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE,
"Cron", "crnhk", $pl_name);
$job = $plugin_obj->getCronJobInstance($job_id);
if($job instanceof ilCronJob)
{
// should never happen but who knows...
if(!sizeof(ilCronManager::getCronJobData($job_id)))
{
// as job is not "imported" from xml
}
return $job;
}
}
return null;
}
// system
else
{
$job_data = array_pop(self::getCronJobData($a_job_id));
if($job_data["job_id"] == $a_job_id)
{
return self::getJobInstance($job_data["job_id"], $job_data["component"],
$job_data["class"], $job_data["path"]);
}
}
$ilLog->write("CRON - job ".$a_job_id." seems invalid or is inactive");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::getMicrotime ( )
staticprotected

Get current microtime.

Returns
float

Definition at line 698 of file class.ilCronManager.php.

Referenced by runJob().

{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}

+ Here is the caller graph for this function:

static ilCronManager::getPluginJobs (   $a_only_active = false)
static

Definition at line 460 of file class.ilCronManager.php.

References $res, createDefaultEntry(), getCronJobData(), IL_COMP_PLUGIN, and IL_COMP_SERVICE.

Referenced by ilCronManagerTableGUI\getItems().

{
global $ilPluginAdmin;
$res = array();
foreach($ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Cron", "crnhk") as $pl_name)
{
$plugin_obj = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE, "Cron", "crnhk", $pl_name);
foreach((array)$plugin_obj->getCronJobInstances() as $job)
{
$item = array_pop(ilCronManager::getCronJobData($job->getId()));
if(!sizeof($item))
{
// as job is not "imported" from xml
}
$item = array_pop(ilCronManager::getCronJobData($job->getId()));
}
if(!$a_only_active ||
$item["job_status"] == 1)
{
$res[$job->getId()] = array($job, $item);
}
}
return $res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::isJobActive (   $a_job_id)
static

Check if given job is currently active.

Parameters
string$a_job_id
Returns
boolean

Definition at line 619 of file class.ilCronManager.php.

References getCronJobData().

Referenced by ilCronManagerGUI\confirmedDeactivate(), ilObjForumAdministrationGUI\getSettingsForm(), ilObjContentObjectGUI\linkChecker(), and ilLPObjectStatisticsGUI\showCronJobInfo().

{
$job = self::getCronJobData($a_job_id);
if((bool)$job[0]["job_status"])
{
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::isJobInactive (   $a_job_id)
static

Check if given job is currently inactive.

Parameters
string$a_job_id
Returns
boolean

Definition at line 635 of file class.ilCronManager.php.

References getCronJobData().

Referenced by ilCronManagerGUI\confirmedActivate().

{
$job = self::getCronJobData($a_job_id);
if(!(bool)$job[0]["job_status"])
{
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::ping (   $a_job_id)
static

Keep cron job alive.

Parameters
string$a_job_id

Definition at line 709 of file class.ilCronManager.php.

References $ilDB.

Referenced by ilLPCronObjectStatistics\gatherCourseLPData(), ilLPCronObjectStatistics\gatherTypesData(), ilLPCronObjectStatistics\gatherUserData(), and ilMembershipCronNotifications\run().

{
global $ilDB;
$ilDB->manipulate("UPDATE cron_job SET ".
" alive_ts = ".$ilDB->quote(time(), "integer").
" WHERE job_id = ".$ilDB->quote($a_job_id, "text"));
}

+ Here is the caller graph for this function:

static ilCronManager::resetJob ( ilCronJob  $a_job)
static

Reset job.

Parameters
ilCronJob$a_job

Definition at line 547 of file class.ilCronManager.php.

References $ilDB, $result, activateJob(), ilCronJob\getId(), ilCronJobResult\STATUS_RESET, and updateJobResult().

Referenced by ilCronManagerGUI\confirmedActivate(), and ilCronManagerGUI\confirmedReset().

{
global $ilDB;
include_once "Services/Cron/classes/class.ilCronJobResult.php";
$result->setCode("job_manual_reset");
$result->setMessage("Cron job re-activated by admin");
$ilDB->manipulate("UPDATE cron_job".
" SET running_ts = ".$ilDB->quote(0, "integer").
" , alive_ts = ".$ilDB->quote(0, "integer").
" , job_result_ts = ".$ilDB->quote(0, "integer").
" WHERE job_id = ".$ilDB->quote($a_job->getId(), "text"));
self::activateJob($a_job, true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::runActiveJobs ( )
static

Run all active jobs.

Definition at line 16 of file class.ilCronManager.php.

References $ilLog, $ilSetting, $row, ilUtil\_getHttpPath(), getJobInstanceById(), and runJob().

{
global $ilLog, $ilSetting;
// separate log for cron
// $this->log->setFilename($_COOKIE["ilClientId"]."_cron.txt");
$ilLog->write("CRON - batch start");
$ilSetting->set("last_cronjob_start_ts", time());
// ilLink::_getStaticLink() should work in crons
if(!defined("ILIAS_HTTP_PATH"))
{
define("ILIAS_HTTP_PATH", ilUtil::_getHttpPath());
}
// system
foreach(self::getCronJobData(null, false) as $row)
{
$job = self::getJobInstanceById($row["job_id"]);
if($job)
{
self::runJob($job, $row);
}
}
// plugins
foreach(self::getPluginJobs(true) as $item)
{
self::runJob($item[0], $item[1]);
}
$ilLog->write("CRON - batch end");
}

+ Here is the call graph for this function:

static ilCronManager::runJob ( ilCronJob  $a_job,
array  $a_job_data,
  $a_manual = false 
)
staticprotected

Run single cron job (internal)

Parameters
ilCronJob$a_job
array$a_job_data
bool$a_manual
Returns
boolean

Definition at line 97 of file class.ilCronManager.php.

References $ilDB, $ilLog, $result, deactivateJob(), getMicrotime(), ilCronJob\isActive(), ilCronJob\run(), sendNotification(), ilCronJobResult\STATUS_CRASHED, ilCronJobResult\STATUS_INVALID_CONFIGURATION, and updateJobResult().

Referenced by runActiveJobs(), and runJobManual().

{
global $ilLog, $ilDB;
$did_run = false;
if($a_job)
{
include_once "Services/Cron/classes/class.ilCronJobResult.php";
// already running?
if($a_job_data["alive_ts"])
{
$ilLog->write("CRON - job ".$a_job_data["job_id"]." still running");
$cut = 60*60*3; // 3h
// is running (and has not pinged) for 3 hours straight, we assume it crashed
if(time()-$a_job_data["alive_ts"] > $cut)
{
$ilDB->manipulate("UPDATE cron_job SET".
" running_ts = ".$ilDB->quote(0, "integer").
" , alive_ts = ".$ilDB->quote(0, "integer").
" WHERE job_id = ".$ilDB->quote($a_job_data["job_id"], "text"));
self::deactivateJob($a_job); // #13082
$result->setCode("job_auto_deactivation_time_limit");
$result->setMessage("Cron job deactivated because it has been inactive for 3 hours");
if(!$a_manual)
{
}
self::updateJobResult($a_job, $result, $a_manual);
$ilLog->write("CRON - job ".$a_job_data["job_id"]." deactivated (assumed crash)");
}
}
// initiate run?
else if($a_job->isActive($a_job_data["job_result_ts"],
$a_job_data["schedule_type"], $a_job_data["schedule_value"], $a_manual))
{
$ilLog->write("CRON - job ".$a_job_data["job_id"]." started");
$ilDB->manipulate("UPDATE cron_job SET".
" running_ts = ".$ilDB->quote(time(), "integer").
" , alive_ts = ".$ilDB->quote(time(), "integer").
" WHERE job_id = ".$ilDB->quote($a_job_data["job_id"], "text"));
$ts_in = self::getMicrotime();
$result = $a_job->run();
$ts_dur = self::getMicrotime()-$ts_in;
// no proper result
if(!$result instanceof ilCronJobResult)
{
$result = new ilCronJobResult();
$result->setCode("job_no_result");
$result->setMessage("Cron job did not return a proper result");
if(!$a_manual)
{
}
$ilLog->write("CRON - job ".$a_job_data["job_id"]." no result");
}
// no valid configuration, job won't work
{
if(!$a_manual)
{
}
$ilLog->write("CRON - job ".$a_job_data["job_id"]." invalid configuration");
}
// success!
else
{
$did_run = true;
}
$result->setDuration($ts_dur);
self::updateJobResult($a_job, $result, $a_manual);
$ilDB->manipulate("UPDATE cron_job SET".
" running_ts = ".$ilDB->quote(0, "integer").
" , alive_ts = ".$ilDB->quote(0, "integer").
" WHERE job_id = ".$ilDB->quote($a_job_data["job_id"], "text"));
$ilLog->write("CRON - job ".$a_job_data["job_id"]." finished");
}
else
{
$ilLog->write("CRON - job ".$a_job_data["job_id"]." returned status inactive");
}
}
return $did_run;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::runJobManual (   $a_job_id)
static

Run single job manually.

Parameters
string$a_job_id
Returns
bool

Definition at line 58 of file class.ilCronManager.php.

References $ilLog, $result, getJobInstanceById(), and runJob().

Referenced by ilCronManagerGUI\confirmedRun().

{
global $ilLog;
$result = false;
$ilLog->write("CRON - manual start (".$a_job_id.")");
$job = self::getJobInstanceById($a_job_id);
if($job)
{
if($job->isManuallyExecutable())
{
$job_data = array_pop(self::getCronJobData($job->getId()));
$result = self::runJob($job, $job_data, true);
}
else
{
$ilLog->write("CRON - job ".$a_job_id." is not intended to be executed manually");
}
}
else
{
$ilLog->write("CRON - job ".$a_job_id." seems invalid or is inactive");
}
$ilLog->write("CRON - manual end (".$a_job_id.")");
return $result;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::sendNotification ( ilCronJob  $a_job,
  $a_message 
)
staticprotected

Send notification to admin about job event(s)

Parameters
ilCronJob$a_job
string$a_message

Definition at line 315 of file class.ilCronManager.php.

Referenced by runJob().

{
// :TODO:
}

+ Here is the caller graph for this function:

static ilCronManager::updateFromXML (   $a_component,
  $a_id,
  $a_class,
  $a_path = null 
)
static

Process data from module.xml/service.xml.

Parameters
string$a_component
string$a_id
string$a_class
string$_path

Definition at line 390 of file class.ilCronManager.php.

References $ilDB, createDefaultEntry(), and getJobInstance().

Referenced by ilObjDefReader\handlerBeginTag().

{
global $ilDB;
if(!$ilDB->tableExists("cron_job"))
{
return;
}
// only if job seems valid
$job = self::getJobInstance($a_id, $a_component, $a_class, $a_path);
if($job)
{
self::createDefaultEntry($job, $a_component, $a_class, $a_path);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::updateJobResult ( ilCronJob  $a_job,
ilCronJobResult  $a_result,
  $a_manual = false 
)
staticprotected

Save job result.

Parameters
ilCronJob$a_job
ilCronJobResult$a_result
bool$a_manual

Definition at line 652 of file class.ilCronManager.php.

References $ilDB, $ilUser, ilCronJobResult\getCode(), ilCronJobResult\getDuration(), ilCronJob\getId(), ilCronJobResult\getMessage(), and ilCronJobResult\getStatus().

Referenced by resetJob(), and runJob().

{
global $ilDB, $ilUser;
$user_id = $a_manual ? $ilUser->getId() : 0;
$sql = "UPDATE cron_job SET ".
" job_result_status = ".$ilDB->quote($a_result->getStatus(), "integer").
" , job_result_user_id = ".$ilDB->quote($user_id, "integer").
" , job_result_code = ".$ilDB->quote($a_result->getCode(), "text").
" , job_result_message = ".$ilDB->quote($a_result->getMessage(), "text").
" , job_result_type = ".$ilDB->quote($a_manual, "integer").
" , job_result_ts = ".$ilDB->quote(time(), "integer").
" , job_result_dur = ".$ilDB->quote($a_result->getDuration()*1000, "integer").
" WHERE job_id = ".$ilDB->quote($a_job->getId(), "text");
$ilDB->manipulate($sql);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCronManager::updateJobSchedule ( ilCronJob  $a_job,
  $a_schedule_type,
  $a_schedule_value 
)
static

Update job schedule.

Parameters
ilCronJob$a_job
int$a_schedule_type
int$a_schedule_value

Definition at line 677 of file class.ilCronManager.php.

References $ilDB, ilCronJob\getId(), ilCronJob\getValidScheduleTypes(), and ilCronJob\hasFlexibleSchedule().

Referenced by createDefaultEntry(), ilCronManagerTableGUI\parseJobToData(), and ilCronManagerGUI\update().

{
global $ilDB;
if($a_schedule_type === null ||
($a_job->hasFlexibleSchedule() &&
in_array($a_schedule_type, $a_job->getValidScheduleTypes())))
{
$sql = "UPDATE cron_job SET ".
" schedule_type = ".$ilDB->quote($a_schedule_type, "integer").
" , schedule_value = ".$ilDB->quote($a_schedule_value, "integer").
" WHERE job_id = ".$ilDB->quote($a_job->getId(), "text");
$ilDB->manipulate($sql);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: