---
src/wp-cron.php | 14 +++++++++++++-
src/wp-includes/cron.php | 32 ++++++++++++++++++++++++++++++--
2 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/src/wp-cron.php b/src/wp-cron.php
index 15c6676..f3625f2 100644
a
|
b
|
function _get_cron_lock() { |
55 | 55 | return $value; |
56 | 56 | } |
57 | 57 | |
58 | | if ( false === $crons = _get_cron_array() ) |
| 58 | if ( false === $crons = _get_cron_array() ) { |
59 | 59 | die(); |
| 60 | } |
| 61 | |
| 62 | $should_skip = false; |
| 63 | // Don't process cron for suspended blogs. |
| 64 | if ( is_multisite() && ( $current_blog->archived || $current_blog->spam || $current_blog->deleted ) ) { |
| 65 | $should_skip = true; |
| 66 | } |
| 67 | /** This filter is documented in wp-includes/cron.php */ |
| 68 | if ( true === apply_filters( 'skip_cron_for_blog', $should_skip, $current_blog ) ) { |
| 69 | return; |
| 70 | } |
| 71 | unset( $should_skip ); |
60 | 72 | |
61 | 73 | $keys = array_keys( $crons ); |
62 | 74 | $gmt_time = microtime( true ); |
diff --git a/src/wp-includes/cron.php b/src/wp-includes/cron.php
index 493e0ec..d52b91b 100644
a
|
b
|
function spawn_cron( $gmt_time = 0 ) { |
333 | 333 | * Run scheduled callbacks or spawn cron for all scheduled events. |
334 | 334 | * |
335 | 335 | * @since 2.1.0 |
| 336 | * |
| 337 | * @global object $current_blog |
336 | 338 | */ |
337 | 339 | function wp_cron() { |
| 340 | global $current_blog; |
| 341 | |
338 | 342 | // Prevent infinite loops caused by lack of wp-cron.php |
339 | | if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false || ( defined('DISABLE_WP_CRON') && DISABLE_WP_CRON ) ) |
| 343 | if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false || ( defined('DISABLE_WP_CRON') && DISABLE_WP_CRON ) ) { |
| 344 | return; |
| 345 | } |
| 346 | |
| 347 | if ( false === $crons = _get_cron_array() ) { |
340 | 348 | return; |
| 349 | } |
341 | 350 | |
342 | | if ( false === $crons = _get_cron_array() ) |
| 351 | $should_skip = false; |
| 352 | // Don't process cron for suspended blogs. |
| 353 | if ( is_multisite() && ( $current_blog->archived || $current_blog->spam || $current_blog->deleted ) ) { |
| 354 | $should_skip = true; |
| 355 | } |
| 356 | /** |
| 357 | * Allow to either force skip a cron run or to force cron to run even for suspended blogs. |
| 358 | * |
| 359 | * @since 4.5.0 |
| 360 | * |
| 361 | * @param bool $should_skip Whether the cron run is going to be skipped. |
| 362 | * Will be `false` for single-site or non-suspended multi-site blogs |
| 363 | * or `true` for suspended blogs. |
| 364 | * Set to `false` to force cron to run or `true` to force cron to quit. |
| 365 | * @param null|object $current_blog The blog object for which cron will run or null if not in |
| 366 | * multi-site. |
| 367 | */ |
| 368 | if ( true === apply_filters( 'skip_cron_for_blog', $should_skip, $current_blog ) ) { |
343 | 369 | return; |
| 370 | } |
| 371 | unset( $should_skip ); |
344 | 372 | |
345 | 373 | $gmt_time = microtime( true ); |
346 | 374 | $keys = array_keys( $crons ); |