WordPress.org

Make WordPress Core

Ticket #40063: 40063.diff

File 40063.diff, 2.1 KB (added by flixos90, 4 years ago)
  • src/wp-includes/ms-blogs.php

     
    473473}
    474474
    475475/**
     476 * Cleans the site details cache for a site.
     477 *
     478 * @since 4.7.4
     479 * @private
     480 *
     481 * @param int $site_id Optional. Site ID. Default is the current site ID.
     482 */
     483function _clean_site_details_cache( $site_id = 0 ) {
     484        $site_id = (int) $site_id;
     485        if ( ! $site_id ) {
     486                $site_id = get_current_blog_id();
     487        }
     488
     489        wp_cache_delete( $blog_id, 'site-details' );
     490        wp_cache_delete( $blog_id, 'blog-details' );
     491}
     492
     493/**
    476494 * Retrieves site data given a site ID or site object.
    477495 *
    478496 * Site data will be cached and returned after being passed through a filter.
     
    736754        $return = update_option( $option, $value );
    737755        restore_current_blog();
    738756
    739         refresh_blog_details( $id );
    740 
    741757        return $return;
    742758}
    743759
  • src/wp-includes/ms-default-filters.php

     
    8484remove_filter( 'option_siteurl', '_config_wp_siteurl' );
    8585remove_filter( 'option_home',    '_config_wp_home'    );
    8686
    87 // Some options changes should trigger blog details refresh.
    88 add_action( 'update_option_blogname',   'refresh_blog_details', 10, 0 );
    89 add_action( 'update_option_siteurl',    'refresh_blog_details', 10, 0 );
    90 add_action( 'update_option_post_count', 'refresh_blog_details', 10, 0 );
     87// Some options changes should trigger site details refresh.
     88add_action( 'update_option_blogname',   '_clean_site_details_cache', 10, 0 );
     89add_action( 'update_option_siteurl',    '_clean_site_details_cache', 10, 0 );
     90add_action( 'update_option_post_count', '_clean_site_details_cache', 10, 0 );
     91add_action( 'update_option_home',       '_clean_site_details_cache', 10, 0 );
    9192
    9293// If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
    9394add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );