Ticket #37948: 37948.diff
File 37948.diff, 2.5 KB (added by , 5 years ago) |
---|
-
src/wp-includes/class-wp-site.php
170 170 return false; 171 171 } 172 172 173 if ( ! is_multisite() ) { 174 if ( 1 !== $site_id ) { 175 return false; 176 } 177 178 $home = parse_url( get_option( 'home' ) ); 179 180 $_site = new stdClass(); 181 $_site->blog_id = $site_id; 182 $_site->domain = $home['host']; 183 $_site->path = isset( $home['path'] ) ? $home['path'] : '/'; 184 $_site->site_id = 1; 185 186 return new WP_Site( $_site ); 187 } 188 173 189 $_site = wp_cache_get( $site_id, 'sites' ); 174 190 175 191 if ( ! $_site ) { … … 236 252 case 'siteurl': 237 253 case 'post_count': 238 254 case 'home': 239 if ( ! did_action( 'ms_loaded' ) ) {255 if ( is_multisite() && ! did_action( 'ms_loaded' ) ) { 240 256 return null; 241 257 } 242 258 $details = $this->get_details(); … … 267 283 case 'siteurl': 268 284 case 'post_count': 269 285 case 'home': 270 if ( ! did_action( 'ms_loaded' ) ) {286 if ( is_multisite() && ! did_action( 'ms_loaded' ) ) { 271 287 return false; 272 288 } 273 289 return true; … … 317 333 318 334 if ( false === $details ) { 319 335 320 switch_to_blog( $this->blog_id ); 336 if ( is_multisite() ) { 337 switch_to_blog( $this->blog_id ); 338 } 339 321 340 // Create a raw copy of the object for backwards compatibility with the filter below. 322 341 $details = new stdClass(); 323 342 foreach ( get_object_vars( $this ) as $key => $value ) { … … 327 346 $details->siteurl = get_option( 'siteurl' ); 328 347 $details->post_count = get_option( 'post_count' ); 329 348 $details->home = get_option( 'home' ); 330 restore_current_blog();331 349 350 if ( is_multisite() ) { 351 restore_current_blog(); 352 } 353 332 354 $cache_details = true; 333 355 foreach ( array( 'blogname', 'siteurl', 'post_count', 'home' ) as $field ) { 334 356 if ( false === $details->$field ) { -
src/wp-settings.php
118 118 require( ABSPATH . WPINC . '/class-wp-network-query.php' ); 119 119 require( ABSPATH . WPINC . '/ms-blogs.php' ); 120 120 require( ABSPATH . WPINC . '/ms-settings.php' ); 121 } elseif ( ! defined( 'MULTISITE' ) ) { 122 define( 'MULTISITE', false ); 121 } else { 122 if ( ! defined( 'MULTISITE' ) ) { 123 define( 'MULTISITE', false ); 124 } 125 require_once( ABSPATH . WPINC . '/class-wp-site.php' ); 123 126 } 124 127 125 128 register_shutdown_function( 'shutdown_action_hook' );