Make WordPress Core

Changeset 38357


Ignore:
Timestamp:
08/26/2016 09:21:33 AM (8 years ago)
Author:
wonderboymusic
Message:

Cron: clarify descriptions for Cron API functions.

Props johnbillion.
Fixes #37769.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/cron.php

    r38148 r38357  
    11<?php
    22/**
    3  * WordPress CRON API
     3 * WordPress Cron API
    44 *
    55 * @package WordPress
     
    77
    88/**
    9  * Schedules a hook to run only once.
    10  *
    11  * Schedules a hook which will be executed once by the WordPress actions core at
     9 * Schedules an event to run only once.
     10 *
     11 * Schedules an event which will execute once by the WordPress actions core at
    1212 * a time which you specify. The action will fire off when someone visits your
    1313 * WordPress site, if the schedule time has passed.
    1414 *
    1515 * 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` values
     16 * with the same action hook will be ignored unless you pass unique `$args` values
    1717 * for each scheduled event.
    1818 *
     
    2020 * @link https://codex.wordpress.org/Function_Reference/wp_schedule_single_event
    2121 *
    22  * @param int $timestamp Timestamp for when to run the event.
    23  * @param string $hook Action hook to execute when cron is 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.
    2424 * @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.
    2626 */
    2727function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
     
    4444     * @since 3.1.0
    4545     *
    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     * }
    4754     */
    4855    $event = apply_filters( 'schedule_event', $event );
     
    6067
    6168/**
    62  * Schedule a periodic event.
     69 * Schedule a recurring event.
    6370 *
    6471 * Schedules a hook which will be executed by the WordPress actions core on a
     
    6673 * visits your WordPress site, if the scheduled time has passed.
    6774 *
    68  * Valid values for the recurrence are hourly, daily and twicedaily. These can
     75 * Valid values for the recurrence are hourly, daily, and twicedaily. These can
    6976 * be extended using the {@see 'cron_schedules'} filter in wp_get_schedules().
    7077 *
     
    7380 * @since 2.1.0
    7481 *
    75  * @param int $timestamp Timestamp for when to run the event.
     82 * @param int $timestamp Unix timestamp (UTC) for when to run the event.
    7683 * @param string $recurrence How often the event should recur.
    77  * @param string $hook Action hook to execute when cron is run.
     84 * @param string $hook Action hook to execute when event is run.
    7885 * @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.
    8087 */
    8188function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) {
     
    111118 * @since 2.1.0
    112119 *
    113  * @param int $timestamp Timestamp for when to run the event.
     120 * @param int $timestamp Unix timestamp (UTC) for when to run the event.
    114121 * @param string $recurrence How often the event should recur.
    115  * @param string $hook Action hook to execute when cron is run.
     122 * @param string $hook Action hook to execute when event is run.
    116123 * @param array $args Optional. Arguments to pass to the hook's callback function.
    117  * @return false|void False when an event is not scheduled.
     124 * @return false|void False if the event does not get rescheduled.
    118125 */
    119126function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array() ) {
     
    153160
    154161/**
    155  * Unschedule a previously scheduled cron job.
    156  *
    157  * The $timestamp and $hook parameters are required, so that the event can be
     162 * Unschedule a previously scheduled event.
     163 *
     164 * The $timestamp and $hook parameters are required so that the event can be
    158165 * identified.
    159166 *
    160167 * @since 2.1.0
    161168 *
    162  * @param int $timestamp Timestamp for when to run the event.
     169 * @param int $timestamp Unix timestamp (UTC) for when to run the event.
    163170 * @param string $hook Action hook, the execution of which will be unscheduled.
    164171 * @param array $args Arguments to pass to the hook's callback function.
     
    166173 * to uniquely identify the scheduled event, so they should be the same
    167174 * 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.
    169176 */
    170177function wp_unschedule_event( $timestamp, $hook, $args = array() ) {
     
    185192
    186193/**
    187  * Unschedule all cron jobs attached to a specific hook.
     194 * Unschedule all events attached to the specified hook.
    188195 *
    189196 * @since 2.1.0
    190197 *
    191198 * @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.
    193200 */
    194201function wp_clear_scheduled_hook( $hook, $args = array() ) {
     
    216223
    217224/**
    218  * Retrieve the next timestamp for a cron event.
    219  *
    220  * @since 2.1.0
    221  *
    222  * @param string $hook Action hook to execute when cron is run.
     225 * Retrieve the next timestamp for an event.
     226 *
     227 * @since 2.1.0
     228 *
     229 * @param string $hook Action hook to execute when event is run.
    223230 * @param array $args Optional. Arguments to pass to the hook's callback function.
    224  * @return false|int The UNIX timestamp 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.
    225232 */
    226233function wp_next_scheduled( $hook, $args = array() ) {
     
    241248 * @since 2.1.0
    242249 *
    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).
    244251 */
    245252function spawn_cron( $gmt_time = 0 ) {
     
    251258
    252259    /*
    253      * Get the cron lock, which is a unix timestamp of when the last cron was spawned
     260     * Get the cron lock, which is a Unix timestamp of when the last cron was spawned
    254261     * and has not finished running.
    255262     *
     
    365372
    366373/**
    367  * Retrieve supported and filtered Cron recurrences.
    368  *
    369  * The supported recurrences are 'hourly' and 'daily'. A plugin may add more by
    370  * hooking into the {@see 'cron_schedules'} filter. The filter accepts an array of
    371  * arrays. The outer array has a key that is the name of the schedule or for
     374 * Retrieve supported event recurrence schedules.
     375 *
     376 * 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
    372379 * example 'weekly'. The value is an array with two keys, one is 'interval' and
    373380 * the other is 'display'.
     
    411418
    412419/**
    413  * Retrieve Cron schedule for hook with arguments.
    414  *
    415  * @since 2.1.0
    416  *
    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.
     420 * Retrieve the recurrence schedule for an event.
     421 *
     422 * @see wp_get_schedules() for available schedules.
     423 *
     424 * @since 2.1.0
     425 *
     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.
    420429 */
    421430function wp_get_schedule($hook, $args = array()) {
Note: See TracChangeset for help on using the changeset viewer.