function cron__run_cronjobs() { $now = time(); // cronjobs will be executed in that order ... $cronjobs = array('check_for_registration_end', 'check_for_session_reminders', 'apply_permanent_queries', 'process_mail_queue', 'retrieve_emails', 'update_participants_history', 'check_for_noshow_warnings', 'check_for_participant_exclusion', 'send_participant_statistics', 'send_experiment_calendar', 'run_webalizer'); $query = "SELECT * from " . table('cron_jobs') . " WHERE enabled='y'"; $result = or_query($query); $cronprop = array(); while ($line = pdo_fetch_assoc($result)) { $cronprop[$line['job_name']] = $line; } foreach ($cronjobs as $cronjob) { $continue = true; // properties exist? if (!(isset($cronprop[$cronjob]) && function_exists('cron__' . $cronjob))) { $continue = false; } // is due? if ($continue) { $due = cron__job_is_due($cronprop[$cronjob], $now); if (!$due) { $continue = false; } } // run if ($continue) { // execute job $function_name = 'cron__' . $cronjob; $done = $function_name(); // save and log job $ready = cron__save_and_log_job($cronjob, $now, $done); } } clearpixel(); }
$menu__area = "options"; $title = "regular_tasks"; include "header.php"; if ($proceed) { $allow = check_allow('regular_tasks_show', 'options_main.php'); } if ($proceed) { if (isset($_REQUEST['exec']) && $_REQUEST['exec'] && isset($_REQUEST['job_name']) && $_REQUEST['job_name']) { $allow = check_allow('regular_tasks_run', 'cronjob_main.php'); if ($proceed) { $cronjob = $_REQUEST['job_name']; $now = time(); $function_name = 'cron__' . $cronjob; $done = $function_name(); // save and log job $ready = cron__save_and_log_job($cronjob, $now, $done); log__admin("cronjob_run", $cronjob); message(lang('ran_cronjob_xxx') . ' ' . $cronjob); redirect('admin/' . thisdoc()); } } } if ($proceed) { echo '<center><BR>'; if (check_allow('regular_tasks_add')) { echo button_link('cronjob_edit.php?addit=true', lang('create_new'), 'plus-circle') . '<BR>'; } echo '<BR> <table class="or_listtable"><thead> <TR style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';"> <TD></TD>