Make WordPress Core

Changeset 29668


Ignore:
Timestamp:
09/02/2014 07:29:47 AM (10 years ago)
Author:
SergeyBiryukov
Message:

Simplify the code for calling refresh_blog_details() whenever 'blogname', 'siteurl', or 'post_count' option is updated.

props pento, nacin.
fixes #26410.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

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

    r29667 r29668  
    236236 * @since MU
    237237 *
    238  * @param int $blog_id Blog ID
    239  */
    240 function refresh_blog_details( $blog_id ) {
     238 * @param int $blog_id Optional. Blog ID. Defaults to current blog.
     239 */
     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    }
     245
    242246    $details = get_blog_details( $blog_id, false );
    243247    if ( ! $details ) {
     
    262266     */
    263267    do_action( 'refresh_blog_details', $blog_id );
    264 }
    265 
    266 /**
    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     }
    277268}
    278269
  • trunk/src/wp-includes/ms-default-filters.php

    r28881 r29668  
    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.
Note: See TracChangeset for help on using the changeset viewer.