Make WordPress Core

Ticket #25030: 25030.2.diff

File 25030.2.diff, 1.7 KB (added by jeremyfelt, 8 years ago)
  • src/wp-includes/functions.php

     
    15501550        }
    15511551
    15521552        // If multisite (and if not the main site in a post-MU network)
    1553         if ( is_multisite() && ! ( is_main_site() && defined( 'MULTISITE' ) ) ) {
     1553        if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
    15541554
    15551555                if ( ! get_site_option( 'ms_files_rewriting' ) ) {
    15561556                        // If ms-files rewriting is disabled (networks created post-3.5), it is fairly straightforward:
     
    32643264}
    32653265
    32663266/**
     3267 * Checks either current site or a supplied site ID against the defined main site ID
     3268 * to determine if this is the main network.
     3269 *
     3270 * @since 3.7.0
     3271 * @package WordPress
     3272 *
     3273 * @param string $site_id optional site id to test (default current site)
     3274 *
     3275 * @return bool True if not multisite or if $site_id is the main network
     3276 */
     3277function is_main_network( $site_id = '' ) {
     3278        global $current_site, $wpdb;
     3279
     3280        // What are the repercussions of returning true to a network function when there is no network?
     3281        if ( ! is_multisite() )
     3282                return true;
     3283
     3284        if ( ! $site_id )
     3285                $site_id = $current_site->id;
     3286
     3287        if ( defined( 'PRIMARY_NETWORK_ID' ) && $site_id == PRIMARY_NETWORK_ID )
     3288                return true;
     3289
     3290        // What if the current site is 1 and PRIMARY_NETWORK_ID is not
     3291        if ( 1 == $current_site->id && $site_id == $current_site->id )
     3292                return true;
     3293
     3294        // This query should be cached
     3295        if ( $site_id == $wpdb->get_var( "SELECT id FROM $wpdb->site ORDER BY id LIMIT 1" ) )
     3296                return true;
     3297
     3298        return false;
     3299}
     3300
     3301/**
    32673302 * Whether global terms are enabled.
    32683303 *
    32693304 *