Make WordPress Core

Ticket #29077: 29077.patch

File 29077.patch, 1019 bytes (added by paulschreiber, 11 years ago)
  • src/wp-includes/cron.php

     
    107107        $interval = 0;
    108108
    109109        // First we try to get it from the schedule
    110         if ( 0 == $interval )
     110        if ( isset( $schedules[ $recurrence ] ) ) {
    111111                $interval = $schedules[$recurrence]['interval'];
     112    }
     113
    112114        // Now we try to get it from the saved interval in case the schedule disappears
    113         if ( 0 == $interval )
     115        if ( 0 == $interval ) {
    114116                $interval = $crons[$timestamp][$hook][$key]['interval'];
     117    }
     118
    115119        // Now we assume something is wrong and fail to schedule
    116         if ( 0 == $interval )
     120        if ( 0 == $interval ) {
    117121                return false;
     122    }
    118123
    119124        $now = time();
    120125
    121         if ( $timestamp >= $now )
     126        if ( $timestamp >= $now ) {
    122127                $timestamp = $now + $interval;
    123         else
     128        } else {
    124129                $timestamp = $now + ($interval - (($now - $timestamp) % $interval));
     130    }
    125131
    126132        wp_schedule_event( $timestamp, $recurrence, $hook, $args );
    127133}