Ticket #5637: cron.phpdoc.r6603.diff
File cron.phpdoc.r6603.diff, 6.1 KB (added by , 17 years ago) |
---|
-
wp-includes/cron.php
1 1 <?php 2 2 3 /** 4 * wp_schedule_single_event() - Schedule a one-time event via cron 5 * 6 * Schedules a hook which will be executed once by the Wordpress actions core at a time which you 7 * specify. The action will fire off when someone visits your WordPress site, if the schedule time 8 * has passed. 9 * 10 * @since 2.1.0 11 * 12 * @param int $timestamp UNIX timestamp of when the event should occur 13 * @param string $hook The name of an action hook to execute 14 * @param array $args optional Arguments to pass to the hook function(s) 15 */ 3 16 function wp_schedule_single_event( $timestamp, $hook, $args = array()) { 4 17 $crons = _get_cron_array(); 5 18 $key = md5(serialize($args)); … … 8 21 _set_cron_array( $crons ); 9 22 } 10 23 24 /** 25 * wp_schedule_event() - Schedule a periodic event 26 * 27 * Schedules a hook which will be executed by the WordPress actions core on a specific interval, 28 * specified by you. The action will trigger when someone visits your WordPress site, if the 29 * scheduled time has passed. 30 * 31 * @since 2.1.0 32 * 33 * @param int $timestamp UNIX timestamp of the first time the event should occur 34 * @param string $recurrence How often the event should recur 35 * @param string $hook The name of an action hook to execute 36 * @param array $args optional Arguments to pass to the hook function(s) 37 */ 11 38 function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) { 12 39 $crons = _get_cron_array(); 13 40 $schedules = wp_get_schedules(); … … 19 46 _set_cron_array( $crons ); 20 47 } 21 48 49 /** 50 * wp_reschedule_event() - Reschedule a recurring event 51 * 52 * @since 2.1.0 53 * 54 * @param int $timestamp UNIX timestamp to reschedule to 55 * @param string $recurrence How often the event should recur 56 * @param string $hook The name of an action hook to execute 57 * @param array $args optional Arguments to pass to the hook function(s) 58 */ 22 59 function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) { 23 60 $crons = _get_cron_array(); 24 61 $schedules = wp_get_schedules(); … … 41 78 wp_schedule_event( $timestamp, $recurrence, $hook, $args ); 42 79 } 43 80 81 /** 82 * wp_unschedule_event() - Unschedule a previously-scheduled cron job 83 * 84 * The $timestamp and $hook parameters are required so that the event can be identified. 85 * 86 * @since 2.1.0 87 * 88 * @param int $timestamp UNIX timestamp of the next occurence when the scheduled hook was set to run 89 * @param string $hook The name of an action hook for the event 90 * @param array $args optional Arguments to pass to the hook function(s) 91 */ 44 92 function wp_unschedule_event( $timestamp, $hook, $args = array() ) { 45 93 $crons = _get_cron_array(); 46 94 $key = md5(serialize($args)); … … 52 100 _set_cron_array( $crons ); 53 101 } 54 102 103 /** 104 * wp_clear_scheduled_hook() - Unschedule all cron jobs attached to a specific hook 105 * 106 * @since 2.1.0 107 * 108 * @param string $hook The name of an action hook 109 */ 55 110 function wp_clear_scheduled_hook( $hook ) { 56 111 $args = array_slice( func_get_args(), 1 ); 57 112 … … 59 114 wp_unschedule_event( $timestamp, $hook, $args ); 60 115 } 61 116 117 /** 118 * wp_next_scheduled() - Return the next timestamp for a cron event 119 * 120 * @since 2.1.0 121 * 122 * @param string $hook Name of the action hook. 123 * @param array $args optional Arguments to pass to the hook function(s) 124 * @return int The UNIX timestamp of the next time the scheduled event will occur 125 */ 62 126 function wp_next_scheduled( $hook, $args = array() ) { 63 127 $crons = _get_cron_array(); 64 128 $key = md5(serialize($args)); … … 71 135 return false; 72 136 } 73 137 138 /** 139 * spawn_cron() - {@internal Missing Short Description}} 140 * 141 * {@internal Missing Long Description}} 142 * 143 * @since 2.1.0 144 * 145 * @return unknown 146 */ 74 147 function spawn_cron() { 75 148 $crons = _get_cron_array(); 76 149 … … 104 177 ); 105 178 } 106 179 180 /** 181 * wp_cron() - {@internal Missing Short Description}} 182 * 183 * {@internal Missing Long Description}} 184 * 185 * @since 2.1.0 186 */ 107 187 function wp_cron() { 108 188 // Prevent infinite loops caused by lack of wp-cron.php 109 189 if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false ) … … 130 210 } 131 211 } 132 212 213 /** 214 * wp_get_schedules() - {@internal Missing Short Description}} 215 * 216 * {@internal Missing Long Description}} 217 * 218 * @since 2.1.0 219 */ 133 220 function wp_get_schedules() { 134 221 $schedules = array( 135 222 'hourly' => array( 'interval' => 3600, 'display' => __('Once Hourly') ), … … 138 225 return array_merge( apply_filters( 'cron_schedules', array() ), $schedules ); 139 226 } 140 227 228 /** 229 * wp_get_schedule() - {@internal Missing Short Description}} 230 * 231 * {@internal Missing Long Description}} 232 * 233 * @since 2.1.0 234 * 235 * @param string $hook The name of an action hook 236 * @param array $args optional Arguments to pass to the hook function(s) 237 * @return string|bool 238 */ 141 239 function wp_get_schedule($hook, $args = array()) { 142 240 $crons = _get_cron_array(); 143 241 $key = md5(serialize($args)); … … 154 252 // Private functions 155 253 // 156 254 255 /** 256 * _get_cron_array() - {@internal Missing Short Description}} 257 * 258 * {@internal Missing Long Description} 259 * 260 * @since 2.1.0 261 * @access private 262 * 263 * @return unknown 264 */ 157 265 function _get_cron_array() { 158 266 $cron = get_option('cron'); 159 267 if ( ! is_array($cron) ) … … 167 275 return $cron; 168 276 } 169 277 278 /** 279 * set_cron_array() - {@internal Missing Short Description}} 280 * 281 * {@internal Missing Long Description}} 282 * 283 * @since 2.1.0 284 * @access private 285 * 286 * @param array $cron Cron info array from _get_cron_array() 287 */ 170 288 function _set_cron_array($cron) { 171 289 $cron['version'] = 2; 172 290 update_option( 'cron', $cron ); 173 291 } 174 292 293 /** 294 * _update_cron_array() - Upgrade a Cron info array 295 * 296 * This function upgrades the Cron info array to version 2. 297 * 298 * @since 2.1.0 299 * @access private 300 * 301 * @param array $cron Cron info array from _get_cron_array() 302 * @return array An upgraded Cron info array 303 */ 175 304 function _upgrade_cron_array($cron) { 176 305 if ( isset($cron['version']) && 2 == $cron['version']) 177 306 return $cron; … … 190 319 return $new_cron; 191 320 } 192 321 193 ?> 322 ?> 323 No newline at end of file