function elysia_cron_run in Elysia Cron 7.2
Same name and namespace in other branches
- 5.2 elysia_cron.module \elysia_cron_run()
- 5 elysia_cron.module \elysia_cron_run()
- 6.2 elysia_cron.module \elysia_cron_run()
- 6 elysia_cron.module \elysia_cron_run()
- 7 elysia_cron.module \elysia_cron_run()
Public function to invoke a complete cron_run.
Parameters
bool $manual_run: Consider launched by a user command (don't check for key/ip, protect current user...).
bool $ignore_disable: Run the channel (and all it's jobs) even if disabled.
bool $ignore_time: Run channel (and all it's jobs) job even if not ready.
bool $ignore_running: Run the channel (and all it's jobs) even if already running.
5 calls to elysia_cron_run()
- cron.php in ./
cron.php - drush_elysia_cron_run_wrapper in ./
elysia_cron.drush.inc - Custom callback for 'elysia-cron' drush command.
- elysia_cron_cron in ./
elysia_cron.module - Implements hook_cron().
- elysia_cron_run_form_submit in ./
elysia_cron.admin.inc - Submit handler for 'elysia_cron_run_form' form.
- elysia_cron_run_manually in ./
elysia_cron.module - Menu callback: run cron manually.
File
- ./
elysia_cron.module, line 1243
Code
function elysia_cron_run($manual_run = FALSE, $ignore_disable = FALSE, $ignore_time = FALSE, $ignore_running = FALSE) {
global $_elysia_cron_exit_phase;
// If DISABLED block the execution.
if (!$ignore_disable && variable_get('elysia_cron_disabled', FALSE)) {
elysia_cron_debug('Cron globally disabled, skipping run');
return;
}
if (!empty($_elysia_cron_exit_phase)) {
// We on "poormanscron" mode,
// not necessary to do checks for cron_key or host or permission.
}
elseif (!$manual_run) {
// Check for CRON_KEY or ALLOWED_HOSTS.
if (!drupal_is_cli()) {
$cron_key = variable_get('cron_key', '');
if ($cron_key && (empty($_GET['cron_key']) || $_GET['cron_key'] != $cron_key)) {
elysia_cron_debug('Cron key mismatch, skipping run');
return;
}
$allowed_hosts = variable_get('elysia_cron_allowed_hosts', FALSE);
if ($allowed_hosts && !in_array(ip_address(), explode(',', $allowed_hosts))) {
elysia_cron_debug('Cron ip address mismatch, skipping run');
return;
}
}
}
elseif (!elysia_cron_access('execute elysia_cron')) {
elysia_cron_debug('Access denied for cron launching');
return;
}
elysia_cron_prepare_run($manual_run);
_ec_variable_set('elysia_cron_last_run', time());
_ec_variable_set('cron_last', time());
if ($execute = elysia_cron_lock_env()) {
elysia_cron_initialize();
$available_channel = elysia_cron_run_available_channel($ignore_disable, $ignore_time, $ignore_running);
if ($available_channel) {
// There are jobs ready to be executed
// elysia_cron_internal_execute_channel calls elysia_cron_unlock_env.
elysia_cron_internal_execute_channel($available_channel['name'], $available_channel['jobs'], $ignore_running);
}
else {
// No jobs should be executed, i must unlock cron semaphore.
elysia_cron_unlock_env();
elysia_cron_debug('No channels ready to be executed, skipping cron.');
}
}
elysia_cron_unprepare_run($manual_run);
return $execute;
}