<?php if (fz_config_get('looknfeel', 'bug_report_href')) { ?> <a href="<?php echo fz_config_get('looknfeel', 'bug_report_href'); ?> " class="bug"><?php echo __('Report a bug'); ?> </a> <?php } ?> </div> <?php if (fz_config_get('looknfeel', 'show_credit')) { ?> <a href="http://gpl.univ-avignon.fr" target="#_blank"><?php echo __('A free software from the University of Avignon'); ?> </a> <?php } ?> <?php echo check_cron(); ?> </footer>
} // fix day of week (crontab allows 0 or 7 for sunday) if (in_array(7, $values[4]) && !in_array(0, $values[4])) { $values[4][] = 0; } //DEBUG $head = array('minuti', 'ore', 'giorni del mese', 'mesi', 'giorno settimana'); print "Data attuale: {$c_h}:{$c_mi} del {$c_d}/{$c_m} (giorno settimana: {$c_w})<br><br>"; for ($i = 0; $i < 5; $i++) { print $head[$i] . ': ' . implode(',', $values[$i]) . '<br>'; } //final check if (!in_array($c_mi, $values[0])) { return false; } if (!in_array($c_h, $values[1])) { return false; } if (!in_array($c_d, $values[2])) { return false; } if (!in_array($c_m, $values[3])) { return false; } if (!in_array($c_w, $values[4])) { return false; } return true; } print '<br>Eseguire? ' . (check_cron('9,33 15-17 15-20 * *', time()) ? 'SI' : 'NO');
{ global $db; return $db->query("DO RELEASE_LOCK('cron_lock')"); } /// if running from command-line, try to open aMember cron via HTTP if (is_running_from_commandline() && is_running_without_suexec()) { $db->log_error("Cron is running from command line, running [{$config['root_url']}/cron.php?ok] via curl..."); $ret = get_url("{$config['root_url']}/cron.php?ok"); if ($ret == "OK") { $db->log_error("Cron job finished successfully with the following output: [{$ret}]"); } else { $db->log_error("Cron job finished with the following error message: [{$ret}]"); } exit; } $vars = get_input_vars(); if (!$config['use_cron']) { fatal_error(_CRON_ERROR); } if (isset($_GET['ok'])) { $db->log_error("cron.php started"); } get_lock_cron(); check_cron(); release_lock_cron(); if (isset($_GET['ok'])) { $db->log_error("cron.php finished"); } if (isset($_GET['ok'])) { print "OK"; }
function cron_init($type) { global $DB, $CONF; $now = time(); //REMEMBER Inserire check permessi sui moduli $rs = $DB->Execute("SELECT * FROM " . $CONF[cron_table] . " WHERE locked= 0 AND type={$type}"); if ($rs) { $cron = $rs->GetArray(); if (count($cron) > 0) { foreach ($cron as $value) { //Check if there's a timing match or if type is 1 or 2 if (check_cron($value[timing], $now) || $type == 1 || $type == 2) { $function_part = explode("_", $value["function"]); require_once $CONF[path_base] . $CONF[dir_modules] . $function_part[0] . "/cron.php"; //Check if the param field contain a serialized array if (substr($value[param], 0, 4) == "ser:") { $param = unserialize(substr($value[param], 3)); } else { $param = $value[param]; } //Lock cron to avoid overlap $lock = $DB->Execute("UPDATE " . $CONF[cron_table] . " SET locked=1 WHERE id='" . $value[id] . "'"); if (function_exists($value["function"])) { $value["function"]($param); } //Unlock Cron or delete it if onetime cron (type 2) if ($type != 2) { $lock = $DB->Execute("UPDATE " . $CONF[cron_table] . " SET locked=0 WHERE id='" . $value[id] . "'"); } elseif ($type == 2) { $lock = $DB->Execute("DELETE FROM " . $CONF[cron_table] . " WHERE id='" . $value[id] . "'"); } } } } } }