Changeset 1281

Show
Ignore:
Timestamp:
05/09/08 17:28:14 (2 months ago)
Author:
donncha
Message:

Clean up switching code. Don't switch to current blog.
If using an object cache make sure it knows about MU groups
Added "counts" group for 2.5.1 compatibility

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/wpmu-functions.php

    r1279 r1281  
    323323 
    324324function switch_to_blog( $new_blog ) { 
    325         global $tmpoldblogdetails, $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user
     325        global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache
    326326 
    327327        if ( empty($new_blog) ) 
    328                 $new_blog = $blog_id; 
     328                return; 
     329 
     330        if ( $blog_id == $new_blog ) 
     331                return; 
    329332 
    330333        if ( empty($switched_stack) ) 
     
    351354 
    352355function restore_current_blog() { 
    353         global $table_prefix, $tmpoldblogdetails, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $current_user
     356        global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache
    354357 
    355358        if ( !$switched ) 
     
    18591862} 
    18601863 
     1864if( is_object( $wp_object_cache ) ) { 
     1865        $wp_object_cache->global_groups = array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss'); 
     1866        $wp_object_cache->non_persistent_groups = array('comment', 'counts'); 
     1867} 
     1868 
    18611869?>