Make WordPress Core

Ticket #40201: 40201.3.patch

File 40201.3.patch, 1018 bytes (added by spacedmonkey, 8 years ago)
  • src/wp-includes/ms-blogs.php

     
    445445 *
    446446 * @global bool $_wp_suspend_cache_invalidation
    447447 *
    448  * @param WP_Site $blog The site object to be cleared from cache.
     448 * @param WP_Site|int $blog The site object to be cleared from cache.
     449 * @return bool True if caches clear succeeds, false otherwise.
    449450 */
    450451function clean_blog_cache( $blog ) {
    451452        global $_wp_suspend_cache_invalidation;
     
    454455                return;
    455456        }
    456457
     458        if ( is_object( $blog ) || is_int( $blog ) ) {
     459                $blog = get_site( $blog );
     460        }
     461
     462        if ( ! ( $blog instanceof WP_Site ) ) {
     463                return false;
     464        }
     465
    457466        $blog_id = $blog->blog_id;
    458467        $domain_path_key = md5( $blog->domain . $blog->path );
    459468
     
    478487        do_action( 'clean_site_cache', $blog_id, $blog, $domain_path_key );
    479488
    480489        wp_cache_set( 'last_changed', microtime(), 'sites' );
     490
     491        return true;
    481492}
    482493
    483494/**