Make WordPress Core

Changeset 10521 for trunk/wp-cron.php


Ignore:
Timestamp:
02/07/2009 01:32:34 PM (15 years ago)
Author:
azaozz
Message:

Cron spawning improvement, see #9005

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-cron.php

    r10519 r10521  
    1212ignore_user_abort(true);
    1313
     14if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') )
     15    die();
     16
    1417/**
    1518 * Tell WordPress we are doing the CRON task.
     
    1821 */
    1922define('DOING_CRON', true);
    20 /** Setup WordPress environment */
    21 require_once('./wp-load.php');
    2223
     24if ( !defined('ABSPATH') ) {
     25    /** Setup WordPress environment */
     26    require_once('./wp-load.php');
     27}
     28
     29if ( false === $crons = _get_cron_array() )
     30    die();
     31
     32$keys = array_keys( $crons );
    2333$local_time = time();
    2434
    25 $crons = _get_cron_array();
    26 $keys = array_keys( $crons );
    27 
    28 if (!is_array($crons) || $keys[0] > $local_time) {
    29     set_transient('doing_cron', 0);
    30     return;
    31 }
     35if ( isset($keys[0]) && $keys[0] > $local_time )
     36    die();
    3237
    3338foreach ($crons as $timestamp  => $cronhooks) {
    34 
    3539    if ( $timestamp > $local_time )
    3640        break;
     
    5458}
    5559
    56 set_transient('doing_cron', 0);
    57 
    5860die();
    59 
    60 ?>
Note: See TracChangeset for help on using the changeset viewer.