Make WordPress Core


Ignore:
Timestamp:
09/25/2012 05:26:19 AM (11 years ago)
Author:
nacin
Message:

Introduce constants to allow for easier expression of time periods in seconds. Adds MINUTE_IN_SECONDS, HOUR_IN_SECONDS, DAY_IN_SECONDS, WEEK_IN_SECONDS, YEAR_IN_SECONDS. props nbachiyski, SergeyBiryukov. fixes #20987.

File:
1 edited

Legend:

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

    r21954 r21996  
    2323    // don't schedule a duplicate if there's already an identical event due in the next 10 minutes
    2424    $next = wp_next_scheduled($hook, $args);
    25     if ( $next && $next <= $timestamp + 600 )
     25    if ( $next && $next <= $timestamp + 10 * MINUTE_IN_SECONDS )
    2626        return;
    2727
     
    207207    $lock = get_transient('doing_cron');
    208208
    209     if ( $lock > $gmt_time + 10*60 )
     209    if ( $lock > $gmt_time + 10 * MINUTE_IN_SECONDS )
    210210        $lock = 0;
    211211
     
    319319function wp_get_schedules() {
    320320    $schedules = array(
    321         'hourly' => array( 'interval' => 3600, 'display' => __('Once Hourly') ),
    322         'twicedaily' => array( 'interval' => 43200, 'display' => __('Twice Daily') ),
    323         'daily' => array( 'interval' => 86400, 'display' => __('Once Daily') ),
     321        'hourly'     => array( 'interval' => HOUR_IN_SECONDS,      'display' => __( 'Once Hourly' ) ),
     322        'twicedaily' => array( 'interval' => 12 * HOUR_IN_SECONDS, 'display' => __( 'Twice Daily' ) ),
     323        'daily'      => array( 'interval' => DAY_IN_SECONDS,       'display' => __( 'Once Daily' ) ),
    324324    );
    325325    return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
Note: See TracChangeset for help on using the changeset viewer.