Changeset 29349 for trunk/src/wp-includes/cron.php
- Timestamp:
- 08/01/2014 08:56:11 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/cron.php
r28781 r29349 101 101 * @return bool|null False on failure. Null when event is rescheduled. 102 102 */ 103 function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array() ) {103 function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array() ) { 104 104 $crons = _get_cron_array(); 105 105 $schedules = wp_get_schedules(); 106 $key = md5( serialize($args));106 $key = md5( serialize( $args ) ); 107 107 $interval = 0; 108 108 109 109 // First we try to get it from the schedule 110 if ( 0 == $interval ) 111 $interval = $schedules[$recurrence]['interval']; 110 if ( isset( $schedules[ $recurrence ] ) ) { 111 $interval = $schedules[ $recurrence ]['interval']; 112 } 112 113 // Now we try to get it from the saved interval in case the schedule disappears 113 if ( 0 == $interval ) 114 $interval = $crons[$timestamp][$hook][$key]['interval']; 114 if ( 0 == $interval ) { 115 $interval = $crons[ $timestamp ][ $hook ][ $key ]['interval']; 116 } 115 117 // Now we assume something is wrong and fail to schedule 116 if ( 0 == $interval ) 117 return false; 118 if ( 0 == $interval ) { 119 return false; 120 } 118 121 119 122 $now = time(); 120 123 121 if ( $timestamp >= $now ) 124 if ( $timestamp >= $now ) { 122 125 $timestamp = $now + $interval; 123 else 124 $timestamp = $now + ($interval - (($now - $timestamp) % $interval)); 126 } else { 127 $timestamp = $now + ( $interval - ( ( $now - $timestamp ) % $interval ) ); 128 } 125 129 126 130 wp_schedule_event( $timestamp, $recurrence, $hook, $args );
Note: See TracChangeset
for help on using the changeset viewer.