Make WordPress Core


Ignore:
Timestamp:
03/28/2017 07:35:49 PM (7 years ago)
Author:
jeremyfelt
Message:

Multisite: Respect $_wp_suspend_cache_invalidation when clearing network and site caches.

Props johnjamesjacoby.
Fixes #40028.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-blogs.php

    r40340 r40346  
    444444 * @since 3.5.0
    445445 *
     446 * @global bool $_wp_suspend_cache_invalidation
     447 *
    446448 * @param WP_Site $blog The site object to be cleared from cache.
    447449 */
    448450function clean_blog_cache( $blog ) {
     451    global $_wp_suspend_cache_invalidation;
     452
     453    if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
     454        return;
     455    }
     456
    449457    $blog_id = $blog->blog_id;
    450458    $domain_path_key = md5( $blog->domain . $blog->path );
     
    452460    wp_cache_delete( $blog_id, 'sites' );
    453461    wp_cache_delete( $blog_id, 'site-details' );
    454     wp_cache_delete( $blog_id , 'blog-details' );
     462    wp_cache_delete( $blog_id, 'blog-details' );
    455463    wp_cache_delete( $blog_id . 'short' , 'blog-details' );
    456     wp_cache_delete(  $domain_path_key, 'blog-lookup' );
     464    wp_cache_delete( $domain_path_key, 'blog-lookup' );
     465    wp_cache_delete( $domain_path_key, 'blog-id-cache' );
    457466    wp_cache_delete( 'current_blog_' . $blog->domain, 'site-options' );
    458467    wp_cache_delete( 'current_blog_' . $blog->domain . $blog->path, 'site-options' );
    459     wp_cache_delete( $domain_path_key, 'blog-id-cache' );
    460468
    461469    /**
     
    11501158 * @since 4.6.0
    11511159 *
     1160 * @global bool $_wp_suspend_cache_invalidation
     1161 *
    11521162 * @param int|array $ids Network ID or an array of network IDs to remove from cache.
    11531163 */
    11541164function clean_network_cache( $ids ) {
     1165    global $_wp_suspend_cache_invalidation;
     1166
     1167    if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
     1168        return;
     1169    }
     1170
    11551171    foreach ( (array) $ids as $id ) {
    11561172        wp_cache_delete( $id, 'networks' );
Note: See TracChangeset for help on using the changeset viewer.