Avoid an undefined index notice in wp_reschedule_event().

props paulschreiber.
fixes #29077.
Built from https://develop.svn.wordpress.org/trunk@29349


git-svn-id: http://core.svn.wordpress.org/trunk@29126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-08-01 20:57:16 +00:00
parent 12e961cb61
commit 7753c3ff05

View File

@ -107,21 +107,25 @@ function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) {
$interval = 0;
// First we try to get it from the schedule
if ( 0 == $interval )
if ( isset( $schedules[ $recurrence ] ) ) {
$interval = $schedules[ $recurrence ]['interval'];
}
// Now we try to get it from the saved interval in case the schedule disappears
if ( 0 == $interval )
if ( 0 == $interval ) {
$interval = $crons[ $timestamp ][ $hook ][ $key ]['interval'];
}
// Now we assume something is wrong and fail to schedule
if ( 0 == $interval )
if ( 0 == $interval ) {
return false;
}
$now = time();
if ( $timestamp >= $now )
if ( $timestamp >= $now ) {
$timestamp = $now + $interval;
else
} else {
$timestamp = $now + ( $interval - ( ( $now - $timestamp ) % $interval ) );
}
wp_schedule_event( $timestamp, $recurrence, $hook, $args );
}