Ticket #37769: 37769.patch
File 37769.patch, 8.5 KB (added by , 9 years ago) |
---|
-
src/wp-includes/cron.php
1 1 <?php 2 2 /** 3 * WordPress C RONAPI3 * WordPress Cron API 4 4 * 5 5 * @package WordPress 6 6 */ 7 7 8 8 /** 9 * Schedules a hookto run only once.9 * Schedules an event to run only once. 10 10 * 11 * Schedules a hook which will be executedonce by the WordPress actions core at11 * Schedules an event which will execute once by the WordPress actions core at 12 12 * a time which you specify. The action will fire off when someone visits your 13 13 * WordPress site, if the schedule time has passed. 14 14 * 15 15 * Note that scheduling an event to occur within 10 minutes of an existing event 16 * with the same action hook will be ignored ,unless you pass unique `$args` values16 * with the same action hook will be ignored unless you pass unique `$args` values 17 17 * for each scheduled event. 18 18 * 19 19 * @since 2.1.0 20 20 * @link https://codex.wordpress.org/Function_Reference/wp_schedule_single_event 21 21 * 22 * @param int $timestamp Timestampfor when to run the event.23 * @param string $hook Action hook to execute when cronis run.22 * @param int $timestamp Unix timestamp (UTC) for when to run the event. 23 * @param string $hook Action hook to execute when event is run. 24 24 * @param array $args Optional. Arguments to pass to the hook's callback function. 25 * @return false|void False when an event is not scheduled.25 * @return false|void False if the event does not get scheduled. 26 26 */ 27 27 function wp_schedule_single_event( $timestamp, $hook, $args = array()) { 28 28 // Make sure timestamp is a positive integer … … 43 43 * 44 44 * @since 3.1.0 45 45 * 46 * @param object $event An object containing an event's data. 46 * @param stdClass $event { 47 * An object containing an event's data. 48 * 49 * @type string $hook Action hook to execute when event is run. 50 * @type int $timestamp Unix timestamp (UTC) for when to run the event. 51 * @type string|false $schedule How often the event should recur. See `wp_get_schedules()`. 52 * @type array $args Arguments to pass to the hook's callback function. 53 * } 47 54 */ 48 55 $event = apply_filters( 'schedule_event', $event ); 49 56 … … 59 66 } 60 67 61 68 /** 62 * Schedule a periodicevent.69 * Schedule a recurring event. 63 70 * 64 71 * Schedules a hook which will be executed by the WordPress actions core on a 65 72 * specific interval, specified by you. The action will trigger when someone 66 73 * visits your WordPress site, if the scheduled time has passed. 67 74 * 68 * Valid values for the recurrence are hourly, daily and twicedaily. These can75 * Valid values for the recurrence are hourly, daily, and twicedaily. These can 69 76 * be extended using the {@see 'cron_schedules'} filter in wp_get_schedules(). 70 77 * 71 78 * Use wp_next_scheduled() to prevent duplicates 72 79 * 73 80 * @since 2.1.0 74 81 * 75 * @param int $timestamp Timestampfor when to run the event.82 * @param int $timestamp Unix timestamp (UTC) for when to run the event. 76 83 * @param string $recurrence How often the event should recur. 77 * @param string $hook Action hook to execute when cronis run.84 * @param string $hook Action hook to execute when event is run. 78 85 * @param array $args Optional. Arguments to pass to the hook's callback function. 79 * @return false|void False when an event is not scheduled.86 * @return false|void False if the event does not get scheduled. 80 87 */ 81 88 function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) { 82 89 // Make sure timestamp is a positive integer … … 110 117 * 111 118 * @since 2.1.0 112 119 * 113 * @param int $timestamp Timestampfor when to run the event.120 * @param int $timestamp Unix timestamp (UTC) for when to run the event. 114 121 * @param string $recurrence How often the event should recur. 115 * @param string $hook Action hook to execute when cronis run.122 * @param string $hook Action hook to execute when event is run. 116 123 * @param array $args Optional. Arguments to pass to the hook's callback function. 117 * @return false|void False when an event is notscheduled.124 * @return false|void False if the event does not get rescheduled. 118 125 */ 119 126 function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array() ) { 120 127 // Make sure timestamp is a positive integer … … 152 159 } 153 160 154 161 /** 155 * Unschedule a previously scheduled cron job.162 * Unschedule a previously scheduled event. 156 163 * 157 * The $timestamp and $hook parameters are required ,so that the event can be164 * The $timestamp and $hook parameters are required so that the event can be 158 165 * identified. 159 166 * 160 167 * @since 2.1.0 161 168 * 162 * @param int $timestamp Timestampfor when to run the event.169 * @param int $timestamp Unix timestamp (UTC) for when to run the event. 163 170 * @param string $hook Action hook, the execution of which will be unscheduled. 164 171 * @param array $args Arguments to pass to the hook's callback function. 165 172 * Although not passed to a callback function, these arguments are used 166 173 * to uniquely identify the scheduled event, so they should be the same 167 174 * as those used when originally scheduling the event. 168 * @return false|void False when an event is not unscheduled.175 * @return false|void False if the event does not get unscheduled. 169 176 */ 170 177 function wp_unschedule_event( $timestamp, $hook, $args = array() ) { 171 178 // Make sure timestamp is a positive integer … … 184 191 } 185 192 186 193 /** 187 * Unschedule all cron jobs attached to a specifichook.194 * Unschedule all events attached to the specified hook. 188 195 * 189 196 * @since 2.1.0 190 197 * 191 198 * @param string $hook Action hook, the execution of which will be unscheduled. 192 * @param array $args Optional. Arguments that were to be pass to the hook's callback function.199 * @param array $args Optional. Arguments that were to be passed to the hook's callback function. 193 200 */ 194 201 function wp_clear_scheduled_hook( $hook, $args = array() ) { 195 202 // Backward compatibility … … 215 222 } 216 223 217 224 /** 218 * Retrieve the next timestamp for a cron event.225 * Retrieve the next timestamp for an event. 219 226 * 220 227 * @since 2.1.0 221 228 * 222 * @param string $hook Action hook to execute when cronis run.229 * @param string $hook Action hook to execute when event is run. 223 230 * @param array $args Optional. Arguments to pass to the hook's callback function. 224 * @return false|int The U NIXtimestamp of the next time the scheduled event will occur.231 * @return false|int The Unix timestamp of the next time the scheduled event will occur. 225 232 */ 226 233 function wp_next_scheduled( $hook, $args = array() ) { 227 234 $crons = _get_cron_array(); … … 240 247 * 241 248 * @since 2.1.0 242 249 * 243 * @param int $gmt_time Optional. Unix timestamp . Default 0 (current time is used).250 * @param int $gmt_time Optional. Unix timestamp (UTC). Default 0 (current time is used). 244 251 */ 245 252 function spawn_cron( $gmt_time = 0 ) { 246 253 if ( ! $gmt_time ) … … 250 257 return; 251 258 252 259 /* 253 * Get the cron lock, which is a unix timestamp of when the last cron was spawned260 * Get the cron lock, which is a Unix timestamp of when the last cron was spawned 254 261 * and has not finished running. 255 262 * 256 263 * Multiple processes on multiple web servers can run this code concurrently, … … 364 371 } 365 372 366 373 /** 367 * Retrieve supported and filtered Cron recurrences.374 * Retrieve supported event recurrence schedules. 368 375 * 369 * The supported recurrences are 'hourly' and 'daily'. A plugin may add more by370 * hooking into the {@see 'cron_schedules'} filter. The filter accepts an array of371 * arrays. The outer array has a key that is the name of the schedule or for376 * The default supported recurrences are 'hourly', 'twicedaily', and 'daily'. A plugin may 377 * add more by hooking into the {@see 'cron_schedules'} filter. The filter accepts an array 378 * of arrays. The outer array has a key that is the name of the schedule or for 372 379 * example 'weekly'. The value is an array with two keys, one is 'interval' and 373 380 * the other is 'display'. 374 381 * … … 410 417 } 411 418 412 419 /** 413 * Retrieve Cron schedule for hook with arguments. 420 * Retrieve the recurrence schedule for an event. 421 * 422 * @see wp_get_schedules() for available schedules. 414 423 * 415 424 * @since 2.1.0 416 425 * 417 * @param string $hook Action hook to execute when cron is run.418 * @param array $args Optional. Arguments to pass to the hook's callback function.419 * @return string|false False, if no schedule. Schedule on success.426 * @param string $hook Action hook to identify the event. 427 * @param array $args Optional. Arguments passed to the event's callback function. 428 * @return string|false False, if no schedule. Schedule name on success. 420 429 */ 421 430 function wp_get_schedule($hook, $args = array()) { 422 431 $crons = _get_cron_array();