24 if ( !defined('ABSPATH') ) { |
24 if ( !defined('ABSPATH') ) { |
25 /** Set up WordPress environment */ |
25 /** Set up WordPress environment */ |
26 require_once( dirname( __FILE__ ) . '/wp-load.php' ); |
26 require_once( dirname( __FILE__ ) . '/wp-load.php' ); |
27 } |
27 } |
28 |
28 |
29 // Uncached doing_cron transient fetch |
29 /** |
|
30 * Retrieves the cron lock. |
|
31 * |
|
32 * Returns the uncached `doing_cron` transient. |
|
33 * |
|
34 * @ignore |
|
35 * @since 3.3.0 |
|
36 * |
|
37 * @return string|false Value of the `doing_cron` transient, 0|false otherwise. |
|
38 */ |
30 function _get_cron_lock() { |
39 function _get_cron_lock() { |
31 global $wpdb; |
40 global $wpdb; |
32 |
41 |
33 $value = 0; |
42 $value = 0; |
34 if ( wp_using_ext_object_cache() ) { |
43 if ( wp_using_ext_object_cache() ) { |
35 // Skip local cache and force refetch of doing_cron transient in case |
44 /* |
36 // another processs updated the cache |
45 * Skip local cache and force re-fetch of doing_cron transient |
|
46 * in case another process updated the cache. |
|
47 */ |
37 $value = wp_cache_get( 'doing_cron', 'transient', true ); |
48 $value = wp_cache_get( 'doing_cron', 'transient', true ); |
38 } else { |
49 } else { |
39 $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) ); |
50 $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) ); |
40 if ( is_object( $row ) ) |
51 if ( is_object( $row ) ) |
41 $value = $row->option_value; |
52 $value = $row->option_value; |
90 wp_unschedule_event( $timestamp, $hook, $v['args'] ); |
101 wp_unschedule_event( $timestamp, $hook, $v['args'] ); |
91 |
102 |
92 /** |
103 /** |
93 * Fires scheduled events. |
104 * Fires scheduled events. |
94 * |
105 * |
|
106 * @ignore |
95 * @since 2.1.0 |
107 * @since 2.1.0 |
96 * |
108 * |
97 * @param string $hook Name of the hook that was scheduled to be fired. |
109 * @param string $hook Name of the hook that was scheduled to be fired. |
98 * @param array $v['args'] The arguments to be passed to the hook. |
110 * @param array $args The arguments to be passed to the hook. |
99 */ |
111 */ |
100 do_action_ref_array( $hook, $v['args'] ); |
112 do_action_ref_array( $hook, $v['args'] ); |
101 |
113 |
102 // If the hook ran too long and another cron process stole the lock, quit. |
114 // If the hook ran too long and another cron process stole the lock, quit. |
103 if ( _get_cron_lock() != $doing_wp_cron ) |
115 if ( _get_cron_lock() != $doing_wp_cron ) |