]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-cron.php
Wordpress 2.6.2-scripts
[autoinstalls/wordpress.git] / wp-cron.php
1 <?php
2 /**
3  * WordPress Cron Implementation for hosts, which do not offer CRON or for which
4  * the user has not setup a CRON job pointing to this file.
5  *
6  * The HTTP request to this file will not slow down the visitor who happens to
7  * visit when the cron job is needed to run.
8  *
9  * @package WordPress
10  */
11
12 ignore_user_abort(true);
13
14 /**
15  * Tell WordPress we are doing the CRON task.
16  *
17  * @var bool
18  */
19 define('DOING_CRON', true);
20 /** Setup WordPress environment */
21 require_once('./wp-load.php');
22
23 if ( $_GET['check'] != wp_hash('187425') )
24         exit;
25
26 if ( get_option('doing_cron') > time() )
27         exit;
28
29 update_option('doing_cron', time() + 30);
30
31 $crons = _get_cron_array();
32 $keys = array_keys($crons);
33 if (!is_array($crons) || $keys[0] > time())
34         return;
35
36 foreach ($crons as $timestamp => $cronhooks) {
37         if ($timestamp > time()) break;
38         foreach ($cronhooks as $hook => $keys) {
39                 foreach ($keys as $key => $args) {
40                         $schedule = $args['schedule'];
41                         if ($schedule != false) {
42                                 $new_args = array($timestamp, $schedule, $hook, $args['args']);
43                                 call_user_func_array('wp_reschedule_event', $new_args);
44                         }
45                         wp_unschedule_event($timestamp, $hook, $args['args']);
46                         do_action_ref_array($hook, $args['args']);
47                 }
48         }
49 }
50
51 update_option('doing_cron', 0);
52
53 ?>