WordPress.org

Make WordPress Core

Ticket #33423: 33423.diff

File 33423.diff, 891 bytes (added by Otto42, 3 years ago)

Suggested patch to avoid massive DB operations

  • wp-admin/includes/upgrade.php

     
    15921592        if ( isset( $cron_array['wp_batch_split_terms'] ) ) {
    15931593                foreach ( $cron_array['wp_batch_split_terms'] as $timestamp_hook => $cron_data ) {
    15941594                        foreach ( $cron_data as $key => $args ) {
    1595                                 wp_unschedule_event( 'wp_batch_split_terms', $timestamp_hook, $args['args'] );
     1595                                unset( $cron_array['wp_batch_split_terms'][$timestamp_hook][$key] );
     1596                                if ( empty($cron_array['wp_batch_split_terms'][$timestamp_hook]) )
     1597                                        unset( $cron_array['wp_batch_split_terms'][$timestamp_hook] );
     1598                                if ( empty($cron_array['wp_batch_split_terms']) )
     1599                                        unset( $cron_array['wp_batch_split_terms'] );                           
    15961600                        }
    15971601                }
    15981602        }
     1603        _set_cron_array( $cron_array );
    15991604}
    16001605
    16011606/**