Ticket #21459: 21459-no-switched.2.diff
File 21459-no-switched.2.diff, 2.9 KB (added by , 12 years ago) |
---|
-
wp-includes/functions.php
1432 1432 * @return array See above for description. 1433 1433 */ 1434 1434 function wp_upload_dir( $time = null ) { 1435 global $_wp_switched;1436 1435 $siteurl = get_option( 'siteurl' ); 1437 1436 $upload_path = get_option( 'upload_path' ); 1438 1437 $upload_path = trim($upload_path); … … 1456 1455 $url = trailingslashit( $siteurl ) . $upload_path; 1457 1456 } 1458 1457 1459 if ( defined('UPLOADS') && ! $main_override && ! $_wp_switched) {1458 if ( defined('UPLOADS') && ! $main_override && ! ms_is_switched() ) { 1460 1459 $dir = ABSPATH . UPLOADS; 1461 1460 $url = trailingslashit( $siteurl ) . UPLOADS; 1462 1461 } 1463 1462 1464 if ( is_multisite() && ! $main_override && ! $_wp_switched) {1463 if ( is_multisite() && ! $main_override && ! ms_is_switched() ) { 1465 1464 if ( defined( 'BLOGUPLOADDIR' ) ) 1466 1465 $dir = untrailingslashit(BLOGUPLOADDIR); 1467 1466 $url = str_replace( UPLOADS, 'files', $url ); -
wp-includes/ms-blogs.php
462 462 * the extra unnecessary work */ 463 463 if ( $new_blog == $GLOBALS['blog_id'] ) { 464 464 do_action( 'switch_blog', $new_blog, $new_blog ); 465 $GLOBALS['_wp_switched'] = true;466 465 return true; 467 466 } 468 467 … … 499 498 } 500 499 501 500 do_action( 'switch_blog', $new_blog, $prev_blog_id ); 502 $GLOBALS['_wp_switched'] = true;503 501 504 502 return true; 505 503 } … … 515 513 function restore_current_blog() { 516 514 global $wpdb, $wp_roles; 517 515 518 if ( ! $GLOBALS['_wp_switched'])516 if ( empty( $GLOBALS['_wp_switched_stack'] ) ) 519 517 return false; 520 518 521 519 $blog = array_pop( $GLOBALS['_wp_switched_stack'] ); 522 520 523 521 if ( $GLOBALS['blog_id'] == $blog ) { 524 522 do_action( 'switch_blog', $blog, $blog ); 525 // If we still have items in the switched stack, consider ourselves still 'switched'526 $GLOBALS['_wp_switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );527 523 return true; 528 524 } 529 525 … … 560 556 } 561 557 562 558 do_action( 'switch_blog', $blog, $prev_blog_id ); 563 564 // If we still have items in the switched stack, consider ourselves still 'switched'565 $GLOBALS['_wp_switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );566 567 559 return true; 568 560 } 569 561 … … 575 567 * @return bool True if switched, false otherwise. 576 568 */ 577 569 function ms_is_switched() { 578 return $GLOBALS['_wp_switched'];570 return ! empty( $GLOBALS['_wp_switched_stack'] ); 579 571 } 580 572 581 573 /** -
wp-includes/ms-settings.php
127 127 $wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id ); 128 128 $table_prefix = $wpdb->get_blog_prefix(); 129 129 $_wp_switched_stack = array(); 130 $_wp_switched = false;131 130 132 131 // need to init cache again after blog_id is set 133 132 wp_start_object_cache();