mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 15:47:38 +02: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;
|
$interval = 0;
|
||||||
|
|
||||||
// First we try to get it from the schedule
|
// First we try to get it from the schedule
|
||||||
if ( 0 == $interval )
|
if ( isset( $schedules[ $recurrence ] ) ) {
|
||||||
$interval = $schedules[ $recurrence ]['interval'];
|
$interval = $schedules[ $recurrence ]['interval'];
|
||||||
|
}
|
||||||
// Now we try to get it from the saved interval in case the schedule disappears
|
// 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'];
|
$interval = $crons[ $timestamp ][ $hook ][ $key ]['interval'];
|
||||||
|
}
|
||||||
// Now we assume something is wrong and fail to schedule
|
// Now we assume something is wrong and fail to schedule
|
||||||
if ( 0 == $interval )
|
if ( 0 == $interval ) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$now = time();
|
$now = time();
|
||||||
|
|
||||||
if ( $timestamp >= $now )
|
if ( $timestamp >= $now ) {
|
||||||
$timestamp = $now + $interval;
|
$timestamp = $now + $interval;
|
||||||
else
|
} else {
|
||||||
$timestamp = $now + ( $interval - ( ( $now - $timestamp ) % $interval ) );
|
$timestamp = $now + ( $interval - ( ( $now - $timestamp ) % $interval ) );
|
||||||
|
}
|
||||||
|
|
||||||
wp_schedule_event( $timestamp, $recurrence, $hook, $args );
|
wp_schedule_event( $timestamp, $recurrence, $hook, $args );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user