From 6c8badc7c7906fc92fcf7f36fc865145e433d783 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 17 Apr 2009 00:23:48 +0000 Subject: [PATCH] Fix handling of old timestamps in wp_reschedule_event(). Props natethelen. fixes #9318 git-svn-id: http://svn.automattic.com/wordpress/trunk@10969 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/cron.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/cron.php b/wp-includes/cron.php index 70bc1ac58..be9ea67e3 100644 --- a/wp-includes/cron.php +++ b/wp-includes/cron.php @@ -88,8 +88,12 @@ function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) { if ( 0 == $interval ) return false; - while ( $timestamp < time() + 1 ) - $timestamp += $interval; + $now = time(); + + if ( $timestamp >= $now ) + $timestamp = $now + $interval; + else + $timestamp = $now + ($interval - (($now - $timestamp) % $interval)); wp_schedule_event( $timestamp, $recurrence, $hook, $args ); }