function elysia_cron_initialize in Elysia Cron 5.2
Same name and namespace in other branches
- 5 elysia_cron.module \elysia_cron_initialize()
- 6.2 elysia_cron.module \elysia_cron_initialize()
- 6 elysia_cron.module \elysia_cron_initialize()
- 7.2 elysia_cron.module \elysia_cron_initialize()
- 7 elysia_cron.module \elysia_cron_initialize()
6 calls to elysia_cron_initialize()
- elysia_cron_admin_page in ./
elysia_cron.admin.inc - elysia_cron_execute_page in ./
elysia_cron.admin.inc - elysia_cron_is_running in ./
elysia_cron.module - Check if cron is currently running. (Not used by elysia_cron, can be used by external modules)
- elysia_cron_reset_stats in ./
elysia_cron.module - elysia_cron_run in ./
elysia_cron.module
File
- ./
elysia_cron.module, line 804
Code
function elysia_cron_initialize($skipscript = false) {
elysia_cron_check_version_update();
global $elysia_cron_settings, $elysia_cron_settings_by_channel;
$elysia_cron_settings = array();
$elysia_cron_settings_by_channel = array();
foreach (elysia_cron_module_jobs() as $job => $jobpars) {
$channel = elysia_cron_get_job_channel($job, 'default');
$defrule = !empty($jobpars['rule']) ? $jobpars['rule'] : elysia_cron_get_channel_rule($channel);
if (!$defrule) {
$defrule = variable_get('elysia_cron_default_rule', '0 * * * *');
}
$defweight = !empty($jobpars['weight']) ? $jobpars['weight'] : 0;
if (!is_numeric($defweight)) {
$defweight = 0;
}
$elysia_cron_settings[$job] = array(
'key' => $job,
'channel' => $channel,
'rule' => elysia_cron_get_job_rule($job, $defrule),
'default_rule' => $defrule,
'weight' => elysia_cron_get_job_weight($job, $defweight),
'default_weight' => $defweight,
'disabled' => elysia_cron_is_job_disabled($job),
'running' => elysia_cron_is_job_running($job),
) + $jobpars;
}
if (!$skipscript) {
$script = variable_get('elysia_cron_script', false);
if ($script) {
elysia_cron_decode_script($script);
}
}
uasort($elysia_cron_settings, '_elysia_cron_sort');
foreach ($elysia_cron_settings as $job => &$conf) {
$stats = elysia_cron_get_job_stats($job);
foreach ($stats as $sk => $sv) {
$conf[$sk] = $sv;
}
$elysia_cron_settings_by_channel[$conf['channel']][$job] =& $elysia_cron_settings[$job];
}
foreach ($elysia_cron_settings_by_channel as $channel => $data) {
uasort($elysia_cron_settings_by_channel[$channel], '_elysia_cron_sort');
$elysia_cron_settings_by_channel[$channel]['#data'] = elysia_cron_get_channel_stats($channel);
$elysia_cron_settings_by_channel[$channel]['#data']['disabled'] = elysia_cron_is_channel_disabled($channel);
}
}