root/tags/2.1.1/wp-cron.php

Revision 4509, 0.8 kB (checked in by ryan, 2 years ago)

Attempt at eliminating cron contention.

  • Property svn:eol-style set to native
Line 
1 <?php
2 ignore_user_abort(true);
3 define('DOING_CRON', TRUE);
4 require_once('wp-config.php');
5
6 if ( $_GET['check'] != md5(DB_PASS . '187425') )
7     exit;
8
9 if ( get_option('doing_cron') > time() )
10     exit;
11
12 update_option('doing_cron', time() + 30);
13
14 $crons = _get_cron_array();
15 $keys = array_keys($crons);
16 if (!is_array($crons) || $keys[0] > time())
17     return;
18 foreach ($crons as $timestamp => $cronhooks) {
19     if ($timestamp > time()) break;
20     foreach ($cronhooks as $hook => $keys) {
21         foreach ($keys as $key => $args) {
22             $schedule = $args['schedule'];
23             if ($schedule != false) {
24                 $new_args = array($timestamp, $schedule, $hook, $args['args']);
25                 call_user_func_array('wp_reschedule_event', $new_args);
26             }
27             wp_unschedule_event($timestamp, $hook, $args['args']);
28              do_action_ref_array($hook, $args['args']);
29         }
30     }
31 }
32
33 update_option('doing_cron', 0);
34
35 ?>
36
Note: See TracBrowser for help on using the browser.