Make WordPress Core

Ticket #25266: 25266.patch

File 25266.patch, 1.2 KB (added by jrtashjian, 8 years ago)
  • src/wp-includes/cron.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    169169                return false;
    170170        }
    171171
     172        $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'args' => $args );
     173        /**
     174         * Filter a single event before it is unscheduled.
     175         *
     176         * @param object $event An object containing an event's data.
     177         */
     178        $event = apply_filters( 'unschedule_event', $event );
     179
     180        // A plugin disallowed this event to be unscheduled
     181        if ( ! $event )
     182                return false;
     183
    172184        $crons = _get_cron_array();
    173         $key = md5(serialize($args));
    174         unset( $crons[$timestamp][$hook][$key] );
    175         if ( empty($crons[$timestamp][$hook]) )
    176                 unset( $crons[$timestamp][$hook] );
    177         if ( empty($crons[$timestamp]) )
    178                 unset( $crons[$timestamp] );
     185        $key = md5(serialize($event->args));
     186        unset( $crons[$event->timestamp][$event->hook][$key] );
     187        if ( empty($crons[$event->timestamp][$event->hook]) )
     188                unset( $crons[$event->timestamp][$event->hook] );
     189        if ( empty($crons[$event->timestamp]) )
     190                unset( $crons[$event->timestamp] );
    179191        _set_cron_array( $crons );
    180192}
    181193