From 3b525395cc6a184dd4e5e543af4ca221f5bebe2a Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 25 Aug 2015 04:31:52 +0000 Subject: [PATCH] Term Splitting: Switch to a faster cron unschedule process to benefit sites with thousands of affected jobs. Fix the cron hook name in the failsafe rescheduler. Props Otto42, dd32, peterwilsoncc See #33423 git-svn-id: https://develop.svn.wordpress.org/trunk@33727 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/upgrade.php | 7 ++----- src/wp-includes/taxonomy.php | 6 +++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index ffdb52b160..95381faa72 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -1590,11 +1590,8 @@ function upgrade_431() { // Fix incorrect cron entries for term splitting $cron_array = _get_cron_array(); if ( isset( $cron_array['wp_batch_split_terms'] ) ) { - foreach ( $cron_array['wp_batch_split_terms'] as $timestamp_hook => $cron_data ) { - foreach ( $cron_data as $key => $args ) { - wp_unschedule_event( 'wp_batch_split_terms', $timestamp_hook, $args['args'] ); - } - } + unset( $cron_array['wp_batch_split_terms'] ); + _set_cron_array( $cron_array ); } } diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index 76db653237..beb536b242 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -4441,15 +4441,15 @@ function _wp_batch_split_terms() { } /** - * In order to avoid the wp_batch_split_terms() job being accidentally removed, + * In order to avoid the _wp_batch_split_terms() job being accidentally removed, * check that it's still scheduled while we haven't finished splitting terms. * * @ignore * @since 4.3.0 */ function _wp_check_for_scheduled_split_terms() { - if ( ! get_option( 'finished_splitting_shared_terms' ) && ! wp_next_scheduled( 'wp_batch_split_terms' ) ) { - wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'wp_batch_split_terms' ); + if ( ! get_option( 'finished_splitting_shared_terms' ) && ! wp_next_scheduled( 'wp_split_shared_term_batch' ) ) { + wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'wp_split_shared_term_batch' ); } }