Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 22102)
+++ wp-includes/functions.php	(working copy)
@@ -3121,13 +3121,13 @@
  * @return bool True if not multisite or $blog_id is main site
  */
 function is_main_site( $blog_id = '' ) {
-	global $current_site, $current_blog;
+	global $current_site;
 
-	if ( !is_multisite() )
+	if ( ! is_multisite() )
 		return true;
 
-	if ( !$blog_id )
-		$blog_id = $current_blog->blog_id;
+	if ( ! $blog_id )
+		$blog_id = get_current_blog_id();
 
 	return $blog_id == $current_site->blog_id;
 }
Index: wp-includes/ms-blogs.php
===================================================================
--- wp-includes/ms-blogs.php	(revision 22102)
+++ wp-includes/ms-blogs.php	(working copy)
@@ -118,11 +118,11 @@
  *
  * @since MU
  *
- * @param int|string|array $fields A blog ID, a blog slug, or an array of fields to query against.
+ * @param int|string|array $fields A blog ID, a blog slug, or an array of fields to query against. Optional. If not specified the current blog ID is used.
  * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. Default is true.
  * @return object Blog details.
  */
-function get_blog_details( $fields, $get_all = true ) {
+function get_blog_details( $fields = null, $get_all = true ) {
 	global $wpdb;
 
 	if ( is_array($fields ) ) {
@@ -166,7 +166,9 @@
 			return false;
 		}
 	} else {
-		if ( !is_numeric( $fields ) )
+		if ( ! $fields )
+			$blog_id = get_current_blog_id();
+		elseif ( ! is_numeric( $fields ) )
 			$blog_id = get_id_from_blogname( $fields );
 		else
 			$blog_id = $fields;
Index: wp-includes/class-wp-xmlrpc-server.php
===================================================================
--- wp-includes/class-wp-xmlrpc-server.php	(revision 22102)
+++ wp-includes/class-wp-xmlrpc-server.php	(working copy)
@@ -3660,7 +3660,8 @@
 	 * @access protected
 	 */
 	function _multisite_getUsersBlogs($args) {
-		global $current_blog;
+		$current_blog = get_blog_details();
+
 		$domain = $current_blog->domain;
 		$path = $current_blog->path . 'xmlrpc.php';
 
Index: wp-includes/ms-load.php
===================================================================
--- wp-includes/ms-load.php	(revision 22102)
+++ wp-includes/ms-load.php	(working copy)
@@ -69,8 +69,10 @@
  * @return bool|string Returns true on success, or drop-in file to include.
  */
 function ms_site_check() {
-	global $wpdb, $current_blog;
+	global $wpdb;
 
+	$blog = get_blog_details();
+
 	// Allow short-circuiting
 	$check = apply_filters('ms_site_check', null);
 	if ( null !== $check )
@@ -80,21 +82,21 @@
 	if ( is_super_admin() )
 		return true;
 
-	if ( '1' == $current_blog->deleted ) {
+	if ( '1' == $blog->deleted ) {
 		if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) )
 			return WP_CONTENT_DIR . '/blog-deleted.php';
 		else
 			wp_die( __( 'This user has elected to delete their account and the content is no longer available.' ), '', array( 'response' => 410 ) );
 	}
 
-	if ( '2' == $current_blog->deleted ) {
+	if ( '2' == $blog->deleted ) {
 		if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) )
 			return WP_CONTENT_DIR . '/blog-inactive.php';
 		else
 			wp_die( sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) );
 	}
 
-	if ( $current_blog->archived == '1' || $current_blog->spam == '1' ) {
+	if ( $blog->archived == '1' || $blog->spam == '1' ) {
 		if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) )
 			return WP_CONTENT_DIR . '/blog-suspended.php';
 		else
Index: wp-admin/includes/class-wp-importer.php
===================================================================
--- wp-admin/includes/class-wp-importer.php	(revision 22102)
+++ wp-admin/includes/class-wp-importer.php	(working copy)
@@ -132,9 +132,6 @@
 				exit();
 			}
 			$blog_id = (int) $blog->blog_id;
-			// Restore global $current_blog
-			global $current_blog;
-			$current_blog = $blog;
 		}
 
 		if ( function_exists( 'is_multisite' ) ) {
@@ -212,8 +209,6 @@
 	 * @return bool
 	 */
 	function is_user_over_quota() {
-		global $current_blog;
-
 		if ( function_exists( 'upload_is_user_over_quota' ) ) {
 			if ( upload_is_user_over_quota( 1 ) ) {
 				echo "Sorry, you have used your upload quota.\n";
Index: wp-admin/ms-delete-site.php
===================================================================
--- wp-admin/ms-delete-site.php	(revision 22102)
+++ wp-admin/ms-delete-site.php	(working copy)
@@ -25,6 +25,8 @@
 	}
 }
 
+$blog = get_blog_details();
+
 $title = __( 'Delete Site' );
 $parent_file = 'tools.php';
 require_once( './admin-header.php' );
@@ -72,7 +74,7 @@
 	<form method="post" name="deletedirect">
 		<?php wp_nonce_field( 'delete-blog' ) ?>
 		<input type="hidden" name="action" value="deleteblog" />
-		<p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $current_blog->domain : $current_blog->domain . $current_blog->path ); ?></strong></label></p>
+		<p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $blog->domain : $blog->domain . $blog->path ); ?></strong></label></p>
 		<?php submit_button( __( 'Delete My Site Permanently' ) ); ?>
 	</form>
  	<?php
