Make WordPress Core


Ignore:
Timestamp:
10/18/2010 08:50:35 PM (14 years ago)
Author:
ryan
Message:

Introduce schedule_event filter. fixes #15146

File:
1 edited

Legend:

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

    r15355 r15837  
    2727
    2828    $crons = _get_cron_array();
    29     $key = md5(serialize($args));
    30     $crons[$timestamp][$hook][$key] = array( 'schedule' => false, 'args' => $args );
     29    $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args );
     30    $event = apply_filters('schedule_event', $event);
     31
     32    // A plugin disallowed this event
     33    if ( ! $event )
     34        return false;
     35
     36    $key = md5(serialize($event->args));
     37
     38    $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args );
    3139    uksort( $crons, "strnatcasecmp" );
    3240    _set_cron_array( $crons );
     
    5462    $crons = _get_cron_array();
    5563    $schedules = wp_get_schedules();
    56     $key = md5(serialize($args));
     64
    5765    if ( !isset( $schedules[$recurrence] ) )
    5866        return false;
    59     $crons[$timestamp][$hook][$key] = array( 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] );
     67
     68    $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] );
     69    $event = apply_filters('schedule_event', $event);
     70
     71    // A plugin disallowed this event
     72    if ( ! $event )
     73        return false;
     74
     75    $key = md5(serialize($event->args));
     76
     77    $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args, 'interval' => $event->interval );
    6078    uksort( $crons, "strnatcasecmp" );
    6179    _set_cron_array( $crons );
Note: See TracChangeset for help on using the changeset viewer.