WordPress.org

Make WordPress Core

Ticket #40028: 40028.diff

File 40028.diff, 1.5 KB (added by johnjamesjacoby, 2 years ago)

Check $_wp_suspend_cache_invalidation (and also some related whitespace & order clean-up in clean_blog_cache())

  • src/wp-includes/ms-blogs.php

     
    446446 * @param WP_Site $blog The site object to be cleared from cache.
    447447 */
    448448function clean_blog_cache( $blog ) {
     449        global $_wp_suspend_cache_invalidation;
     450
     451        if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
     452                return;
     453        }
     454
    449455        $blog_id = $blog->blog_id;
    450456        $domain_path_key = md5( $blog->domain . $blog->path );
    451457
    452458        wp_cache_delete( $blog_id, 'sites' );
    453459        wp_cache_delete( $blog_id, 'site-details' );
    454         wp_cache_delete( $blog_id , 'blog-details' );
     460        wp_cache_delete( $blog_id, 'blog-details' );
    455461        wp_cache_delete( $blog_id . 'short' , 'blog-details' );
    456         wp_cache_delete(  $domain_path_key, 'blog-lookup' );
     462        wp_cache_delete( $domain_path_key, 'blog-lookup' );
     463        wp_cache_delete( $domain_path_key, 'blog-id-cache' );
    457464        wp_cache_delete( 'current_blog_' . $blog->domain, 'site-options' );
    458465        wp_cache_delete( 'current_blog_' . $blog->domain . $blog->path, 'site-options' );
    459         wp_cache_delete( $domain_path_key, 'blog-id-cache' );
    460466
    461467        /**
    462468         * Fires immediately after a site has been removed from the object cache.
     
    11331139 * @param int|array $ids Network ID or an array of network IDs to remove from cache.
    11341140 */
    11351141function clean_network_cache( $ids ) {
     1142        global $_wp_suspend_cache_invalidation;
     1143
     1144        if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
     1145                return;
     1146        }
     1147
    11361148        foreach ( (array) $ids as $id ) {
    11371149                wp_cache_delete( $id, 'networks' );
    11381150