Only in .: cronplus.diff diff -up ../../cronplus/cronplus.module ./cronplus.module --- ../../cronplus/cronplus.module 2007-03-22 16:41:18.000000000 -0700 +++ ./cronplus.module 2007-09-07 10:41:09.000000000 -0700 @@ -189,6 +189,7 @@ function cronplus_settings_status() { */ function cronplus_cron() { // Gather information... + $last_cron = intval(variable_get('cronplus_last_cron', 0)); $now = time(); $now_wkdy = intval(gmdate('w'), $now); // 0=Sunday // For the $now_week, weeks start on Monday, not Sunday. This is a mismatch @@ -199,11 +200,20 @@ function cronplus_cron() { $now_year = intval(gmdate('Y', $now)); $now_date = gmdate('Y-m-d', $now); $now_hour = intval(gmdate('H', $now)); - $last_cron = intval(variable_get('cronplus_last_cron', 0)); - $last_cron_fmt = gmdate('Y-m-d H:i:s', $last_cron); - $last_cron_hour = intval(gmdate('H', $last_cron)); - $last_cron_week = intval(gmdate('W', $last_cron)); - $last_cron_year = intval(gmdate('Y', $last_cron)); + + // Gather the last time each cronplus hook was invoked + $cronplus_hourly_last = intval(variable_get('cronplus_hourly_last', 0)); + $cronplus_daily_last = intval(variable_get('cronplus_daily_last', 0)); + $cronplus_weekly_last = intval(variable_get('cronplus_weekly_last', 0)); + $cronplus_monthly_last = intval(variable_get('cronplus_monthly_last', 0)); + $cronplus_yearly_last = intval(variable_get('cronplus_yearly_last', 0)); + + $last_cron_hour = intval(gmdate('H', $cronplus_hourly_last)); + $last_cron_day = gmdate('Y-m-d', $cronplus_daily_last); + $last_cron_week = intval(gmdate('W', $cronplus_weekly_last)); + $last_cron_month = gmdate('Y-m', $cronplus_monthly_last); + $last_cron_year = intval(gmdate('Y', $cronplus_yearly_last)); + // Preferred hour affects daily, weekly, monthly, and yearly runs $prefer_hour = intval(variable_get('cronplus_preferred_hour', 0)); // Preferred wkdy affects weekly, monthly, and yearly runs @@ -222,7 +232,7 @@ function cronplus_cron() { cronplus_invoke_hook('hourly', $now, $last_cron); } // Daily - if (substr($last_cron_fmt, 0, 10) != $now_date && ($now_hour >= $prefer_hour || $interval > 96000)) { + if (substr($last_cron_day, 0, 10) != $now_date && ($now_hour >= $prefer_hour || $interval > 96000)) { // The sleep() calls in the following logic ensure that calls to cronplus_invoke_hook() // cannot occur multiple times in the same second, no matter how fast the system is. // This is needed because log entries have a precision of only seconds, and we want @@ -240,7 +250,7 @@ function cronplus_cron() { cronplus_invoke_hook('weekly', $now, $last_cron); } // Monthly - if (substr($last_cron_fmt, 0, 7) != $now_month && (($now_wkdy >= $prefer_wkdy && $now_hour >= $prefer_hour) || $interval > 86400*35)) { + if ($now_month != $last_cron_month && (($now_wkdy >= $prefer_wkdy && $now_hour >= $prefer_hour) || $interval > 86400*35)) { sleep(1); cronplus_invoke_hook('monthly', $now, $last_cron); } Only in .: .svn