Make WordPress Core

Ticket #26410: 26410.3.diff

File 26410.3.diff, 1.9 KB (added by nacin, 10 years ago)
  • src/wp-includes/ms-blogs.php

     
    235235 *
    236236 * @since MU
    237237 *
    238  * @param int $blog_id Blog ID
     238 * @param int $blog_id Optional. Blog ID. Defaults to current blog.
    239239 */
    240 function refresh_blog_details( $blog_id ) {
     240function refresh_blog_details( $blog_id = 0 ) {
    241241        $blog_id = (int) $blog_id;
     242        if ( ! $blog_id ) {
     243                $blog_id = get_current_blog_id();
     244        }
    242245        $details = get_blog_details( $blog_id, false );
    243246        if ( ! $details ) {
    244247                // Make sure clean_blog_cache() gets the blog ID
     
    264267}
    265268
    266269/**
    267  * Refresh blog details when an option is updated.
    268  *
    269  * @access private
    270  * @param string $option_name
    271  */
    272 function _wp_refresh_blog_details_on_updated_option( $option_name ) {
    273         $options = array( 'blogname', 'siteurl', 'post_count' );
    274         if ( in_array( $option_name, $options ) ) {
    275                 refresh_blog_details( get_current_blog_id() );
    276         }
    277 }
    278 
    279 /**
    280270 * Update the details for a blog. Updates the blogs table for a given blog id.
    281271 *
    282272 * @since MU
  • src/wp-includes/ms-default-filters.php

     
    7171remove_filter( 'option_home',    '_config_wp_home'    );
    7272
    7373// Some options changes should trigger blog details refresh.
    74 add_action( 'updated_option', '_wp_refresh_blog_details_on_updated_option' );
     74add_action( 'update_option_blogname',   'refresh_blog_details', 10, 0 );
     75add_action( 'update_option_siteurl',    'refresh_blog_details', 10, 0 );
     76add_action( 'update_option_post_count', 'refresh_blog_details', 10, 0 );
    7577
    7678// If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
    7779add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );