From e46b68482095f5e9d0f74ae6f639c5dbe505a727 Mon Sep 17 00:00:00 2001 From: donncha Date: Mon, 21 Jul 2008 10:59:29 +0000 Subject: Backup the object cache when switching and restore it afterwards. git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1387 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-includes/wpmu-functions.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'wp-includes') diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php index 0001f5d..67fc456 100644 --- a/wp-includes/wpmu-functions.php +++ b/wp-includes/wpmu-functions.php @@ -360,6 +360,9 @@ function switch_to_blog( $new_blog ) { if ( $blog_id == $new_blog ) return; + $wp_object_cache->switched_cache[ $blog_id ] = $wp_object_cache->cache; + unset( $wp_object_cache->cache ); + $wpdb->set_blog_id($new_blog); $table_prefix = $wpdb->prefix; $prev_blog_id = $blog_id; @@ -388,6 +391,9 @@ function restore_current_blog() { if ( $blog_id == $blog ) return; + $wp_object_cache->cache = $wp_object_cache->switched_cache[ $blog ]; + unset( $wp_object_cache->switched_cache[ $blog ] ); + $wpdb->set_blog_id($blog); $prev_blog_id = $blog_id; $blog_id = $blog; -- cgit