diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-05-23 17:31:51 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-05-23 17:31:51 +0000 |
| commit | 1c4354fd3d0fb51f54899cf4599aef5e9b7491ea (patch) | |
| tree | df4cf1f71597a0f0e4c3db9e454e18d57e27db6c /wp-includes/wpmu-functions.php | |
| parent | b7a46d708e56cc838ec6faecd2fac2897650c43b (diff) | |
Experimental: warn if blog_id is changed without switch_to_blog() being called because it results in cache pollution
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1310 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/wpmu-functions.php')
| -rw-r--r-- | wp-includes/wpmu-functions.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php index 804a273..27bc088 100644 --- a/wp-includes/wpmu-functions.php +++ b/wp-includes/wpmu-functions.php @@ -322,7 +322,7 @@ function update_blog_option( $id, $key, $value, $refresh = true ) { } function switch_to_blog( $new_blog ) { - global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache; + global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache, $switched_to; if ( empty($new_blog) ) return; @@ -339,6 +339,7 @@ function switch_to_blog( $new_blog ) { $table_prefix = $wpdb->prefix; $prev_blog_id = $blog_id; $blog_id = $new_blog; + $switched_to = $blog_id; if( is_object( $wp_roles ) ) { $wpdb->suppress_errors(); @@ -354,7 +355,7 @@ function switch_to_blog( $new_blog ) { } function restore_current_blog() { - global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache; + global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache, $switched_to; if ( !$switched ) return; @@ -367,6 +368,7 @@ function restore_current_blog() { $prev_blog_id = $blog_id; $blog_id = $blog; $table_prefix = $wpdb->prefix; + $switched_to = $blog_id; if( is_object( $wp_roles ) ) { $wpdb->suppress_errors(); |
