Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 61 lines (45 sloc) 1.255 kB
fb1e531 Cron improvements from masquerade. #2425
ryan authored
1 <?php
a6a1522 File file level phpdoc from jacobsantos. see #7037
ryan authored
2 /**
3 * WordPress Cron Implementation for hosts, which do not offer CRON or for which
58d4742 More pedantry. "Setup" is not a verb. http://notaverb.com/setup
markjaquith authored
4 * the user has not set up a CRON job pointing to this file.
a6a1522 File file level phpdoc from jacobsantos. see #7037
ryan authored
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
fb1e531 Cron improvements from masquerade. #2425
ryan authored
12 ignore_user_abort(true);
a6a1522 File file level phpdoc from jacobsantos. see #7037
ryan authored
13
a4df9a5 Cron spawning improvement, see #9005
azaozz authored
14 if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') )
15 die();
16
a6a1522 File file level phpdoc from jacobsantos. see #7037
ryan authored
17 /**
18 * Tell WordPress we are doing the CRON task.
19 *
20 * @var bool
21 */
22 define('DOING_CRON', true);
fb1e531 Cron improvements from masquerade. #2425
ryan authored
23
a4df9a5 Cron spawning improvement, see #9005
azaozz authored
24 if ( !defined('ABSPATH') ) {
58d4742 More pedantry. "Setup" is not a verb. http://notaverb.com/setup
markjaquith authored
25 /** Set up WordPress environment */
a4df9a5 Cron spawning improvement, see #9005
azaozz authored
26 require_once('./wp-load.php');
27 }
28
29 if ( false === $crons = _get_cron_array() )
30 die();
68b74ef Attempt at eliminating cron contention.
ryan authored
31
0853ba1 Cron improvement, props hailin, fixes #7068
azaozz authored
32 $keys = array_keys( $crons );
a4df9a5 Cron spawning improvement, see #9005
azaozz authored
33 $local_time = time();
0853ba1 Cron improvement, props hailin, fixes #7068
azaozz authored
34
a4df9a5 Cron spawning improvement, see #9005
azaozz authored
35 if ( isset($keys[0]) && $keys[0] > $local_time )
36 die();
0853ba1 Cron improvement, props hailin, fixes #7068
azaozz authored
37
326befa Increase timeout on cron-based requests when checking for upgrades, p…
azaozz authored
38 foreach ($crons as $timestamp => $cronhooks) {
0853ba1 Cron improvement, props hailin, fixes #7068
azaozz authored
39 if ( $timestamp > $local_time )
40 break;
a6a1522 File file level phpdoc from jacobsantos. see #7037
ryan authored
41
68aa623 cron and future post publishing fixes. fixes #3058
ryan authored
42 foreach ($cronhooks as $hook => $keys) {
0853ba1 Cron improvement, props hailin, fixes #7068
azaozz authored
43
44 foreach ($keys as $k => $v) {
45
46 $schedule = $v['schedule'];
47
68aa623 cron and future post publishing fixes. fixes #3058
ryan authored
48 if ($schedule != false) {
0853ba1 Cron improvement, props hailin, fixes #7068
azaozz authored
49 $new_args = array($timestamp, $schedule, $hook, $v['args']);
9431f91 Cron unscheduling fixes.
ryan authored
50 call_user_func_array('wp_reschedule_event', $new_args);
68aa623 cron and future post publishing fixes. fixes #3058
ryan authored
51 }
0853ba1 Cron improvement, props hailin, fixes #7068
azaozz authored
52
53 wp_unschedule_event($timestamp, $hook, $v['args']);
54
55 do_action_ref_array($hook, $v['args']);
fb1e531 Cron improvements from masquerade. #2425
ryan authored
56 }
57 }
58 }
68b74ef Attempt at eliminating cron contention.
ryan authored
59
0853ba1 Cron improvement, props hailin, fixes #7068
azaozz authored
60 die();
Something went wrong with that request. Please try again.