WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/17/2014 07:16:26 PM (7 years ago)
Author:
wonderboymusic
Message:

wp_schedule_single_event() should not prevent scheduling a future duplicate event. It should only reject an event as a duplicate if there is already a similar event scheduled within 10 minutes of the given timestamp.

Adds unit tests, fixes existing cron test.

Props tellyworth.

See [9181], #6966.
Fixes #28213.

File:
1 edited

Legend:

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

    r29732 r29939  
    2121 */
    2222function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
    23     // don't schedule a duplicate if there's already an identical event due in the next 10 minutes
     23    // don't schedule a duplicate if there's already an identical event due within 10 minutes of it
    2424    $next = wp_next_scheduled($hook, $args);
    25     if ( $next && $next <= $timestamp + 10 * MINUTE_IN_SECONDS )
    26         return;
     25    if ( $next && abs( $next - $timestamp ) <= 10 * MINUTE_IN_SECONDS ) {
     26        return;
     27    }
    2728
    2829    $crons = _get_cron_array();
Note: See TracChangeset for help on using the changeset viewer.