source: trunk/www.guidonia.net/wp/wp-cron.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 15 years ago
File size: 1.2 KB
Line 
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
12ignore_user_abort(true);
13
14if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') )
15 die();
16
17/**
18 * Tell WordPress we are doing the CRON task.
19 *
20 * @var bool
21 */
22define('DOING_CRON', true);
23
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 );
33$local_time = time();
34
35if ( isset($keys[0]) && $keys[0] > $local_time )
36 die();
37
38foreach ($crons as $timestamp => $cronhooks) {
39 if ( $timestamp > $local_time )
40 break;
41
42 foreach ($cronhooks as $hook => $keys) {
43
44 foreach ($keys as $k => $v) {
45
46 $schedule = $v['schedule'];
47
48 if ($schedule != false) {
49 $new_args = array($timestamp, $schedule, $hook, $v['args']);
50 call_user_func_array('wp_reschedule_event', $new_args);
51 }
52
53 wp_unschedule_event($timestamp, $hook, $v['args']);
54
55 do_action_ref_array($hook, $v['args']);
56 }
57 }
58}
59
60die();
Note: See TracBrowser for help on using the repository browser.