Make WordPress Core


Ignore:
Timestamp:
08/07/2006 03:50:55 AM (18 years ago)
Author:
ryan
Message:

Rework wp_publish_post() to use wp_update_post() again while turning off filters. Clear the cron schedule for a post when the post timestamp is updated. #2715 #2737

File:
1 edited

Legend:

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

    r3931 r4077  
    5151
    5252function wp_clear_scheduled_hook( $hook ) {
    53     while ( $timestamp = wp_next_scheduled( $hook ) )
     53    $args = array_slice( func_get_args(), 1 );
     54   
     55    while ( $timestamp = wp_next_scheduled( $hook, $args ) )
    5456        wp_unschedule_event( $timestamp, $hook );
    5557}
    5658
    57 function wp_next_scheduled( $hook ) {
     59function wp_next_scheduled( $hook, $args = '' ) {
    5860    $crons = get_option( 'cron' );
    5961    if ( empty($crons) )
    6062        return false;
    6163    foreach ( $crons as $timestamp => $cron )
    62         if ( isset( $cron[$hook] ) )
    63             return $timestamp;
     64        if ( isset( $cron[$hook] ) ) {
     65            if ( empty($args) )
     66                return $timestamp;
     67            if ( $args == $cron[$hook]['args'] )
     68                return $timestamp;
     69        }
    6470    return false;
    6571}
     
    9399
    94100    $keys = array_keys( $crons );
    95     if ( array_shift( $keys ) > time() )
     101    if ( $keys[0] > time() )
    96102        return;
    97103
Note: See TracChangeset for help on using the changeset viewer.