Changes in trunk/wp-includes/cron.php [14414:16938]
- File:
-
- 1 edited
-
trunk/wp-includes/cron.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/cron.php
r14414 r16938 27 27 28 28 $crons = _get_cron_array(); 29 $key = md5(serialize($args)); 30 $crons[$timestamp][$hook][$key] = array( 'schedule' => false, 'args' => $args ); 29 $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args ); 30 $event = apply_filters('schedule_event', $event); 31 32 // A plugin disallowed this event 33 if ( ! $event ) 34 return false; 35 36 $key = md5(serialize($event->args)); 37 38 $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args ); 31 39 uksort( $crons, "strnatcasecmp" ); 32 40 _set_cron_array( $crons ); … … 42 50 * Valid values for the recurrence are hourly, daily and twicedaily. These can 43 51 * be extended using the cron_schedules filter in wp_get_schedules(). 52 * 53 * Use wp_next_scheduled() to prevent duplicates 44 54 * 45 55 * @since 2.1.0 … … 54 64 $crons = _get_cron_array(); 55 65 $schedules = wp_get_schedules(); 56 $key = md5(serialize($args)); 66 57 67 if ( !isset( $schedules[$recurrence] ) ) 58 68 return false; 59 $crons[$timestamp][$hook][$key] = array( 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] ); 69 70 $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] ); 71 $event = apply_filters('schedule_event', $event); 72 73 // A plugin disallowed this event 74 if ( ! $event ) 75 return false; 76 77 $key = md5(serialize($event->args)); 78 79 $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args, 'interval' => $event->interval ); 60 80 uksort( $crons, "strnatcasecmp" ); 61 81 _set_cron_array( $crons ); … … 91 111 $now = time(); 92 112 93 if ( $timestamp >= $now )94 $timestamp = $now + $interval;95 else96 $timestamp = $now + ($interval - (($now - $timestamp) % $interval));113 if ( $timestamp >= $now ) 114 $timestamp = $now + $interval; 115 else 116 $timestamp = $now + ($interval - (($now - $timestamp) % $interval)); 97 117 98 118 wp_schedule_event( $timestamp, $recurrence, $hook, $args ); … … 137 157 // Previously this function took the arguments as discrete vars rather than an array like the rest of the API 138 158 if ( !is_array($args) ) { 139 _deprecated_argument( __FUNCTION__, '3.0 .0', __('This argument has changed to an array to match the behavior of the other cron functions.') );159 _deprecated_argument( __FUNCTION__, '3.0', __('This argument has changed to an array to match the behavior of the other cron functions.') ); 140 160 $args = array_slice( func_get_args(), 1 ); 141 161 } … … 179 199 180 200 if ( defined('DOING_CRON') || isset($_GET['doing_wp_cron']) ) 181 return;182 183 /*184 * do not even start the cron if local server timer has drifted185 * such as due to power failure, or misconfiguration186 */187 $timer_accurate = check_server_timer( $local_time );188 if ( !$timer_accurate )189 201 return; 190 202 … … 394 406 return $new_cron; 395 407 } 396 397 // stub for checking server timer accuracy, using outside standard time sources398 function check_server_timer( $local_time ) {399 return true;400 }
Note: See TracChangeset
for help on using the changeset viewer.