mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
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:
parent
12e961cb61
commit
7753c3ff05
@ -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 );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user