# HG changeset patch # User Dan # Date 1205613268 14400 # Node ID a92002aa470b750a4173238dd8410edfaf9202a7 # Parent 30ef6b618795eea720238b2eaa75af7935bb4865 Backporting cron fixes from unstable diff -r 30ef6b618795 -r a92002aa470b cron.php --- a/cron.php Sun Mar 02 21:34:56 2008 -0500 +++ b/cron.php Sat Mar 15 16:34:28 2008 -0400 @@ -20,27 +20,24 @@ define('ENANO_GIF_SPACER', base64_decode('R0lGODlhAQABAIAAAP///////yH+FUNyZWF0ZWQgd2l0aCBUaGUgR0lNUAAh+QQBCgABACwAAAAAAQABAAACAkwBADs=')); // Don't need a page to load, all we should need is the Enano API -$_GET['title'] = 'Enano:Cron'; require('includes/common.php'); global $db, $session, $paths, $template, $plugins; // Common objects // Hope now that plugins are loaded :-) -$last_run = ( $x = getConfig('cron_last_run') ) ? $x : 0; -$time = strval(time()); -setConfig('cron_last_run', $time); - global $cron_tasks; foreach ( $cron_tasks as $interval => $tasks ) { - $last_run_threshold = time() - ( $interval * 3600 ); + $last_run = intval(getConfig("cron_lastrun_ivl_$interval")); + $last_run_threshold = time() - ( 3600 * $interval ); if ( $last_run_threshold >= $last_run ) { foreach ( $tasks as $task ) { @call_user_func($task); } + setConfig("cron_lastrun_ivl_$interval", strval(time())); } }