Make WordPress Core


Ignore:
Timestamp:
08/31/2016 04:55:01 AM (8 years ago)
Author:
wonderboymusic
Message:

Multisite: use get_current_blog_id() where applicable, in lieu of plucking the $blog_id global from outer space.

See #37699.

File:
1 edited

Legend:

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

    r38431 r38457  
    471471 * @since 3.0.0
    472472 * @access private
    473  *
    474  * @global int $blog_id Blog ID.
    475473 */
    476474function wp_start_object_cache() {
    477     global $blog_id;
    478 
    479475    $first_init = false;
    480476    if ( ! function_exists( 'wp_cache_init' ) ) {
    481477        if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
    482478            require_once ( WP_CONTENT_DIR . '/object-cache.php' );
    483             if ( function_exists( 'wp_cache_init' ) )
     479            if ( function_exists( 'wp_cache_init' ) ) {
    484480                wp_using_ext_object_cache( true );
     481            }
    485482        }
    486483
     
    496493    }
    497494
    498     if ( ! wp_using_ext_object_cache() )
     495    if ( ! wp_using_ext_object_cache() ) {
    499496        require_once ( ABSPATH . WPINC . '/cache.php' );
     497    }
    500498
    501499    /*
     
    504502     * have changed and it may need to update keys and cleanup caches.
    505503     */
    506     if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) )
    507         wp_cache_switch_to_blog( $blog_id );
    508     elseif ( function_exists( 'wp_cache_init' ) )
     504    if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) {
     505        wp_cache_switch_to_blog( get_current_blog_id() );
     506    } elseif ( function_exists( 'wp_cache_init' ) ) {
    509507        wp_cache_init();
     508    }
    510509
    511510    if ( function_exists( 'wp_cache_add_global_groups' ) ) {
Note: See TracChangeset for help on using the changeset viewer.