id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses
12065,Clean up cache re-init code in Multisite,nacin,,"During MS load we initialize the object cache again.
{{{
wp_cache_init(); // need to init cache again after blog_id is set
if ( function_exists('wp_cache_add_global_groups') ) { // need to add these again. Yes, it's an ugly hack
wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss'));
wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
}
}}}
Assuming re-initialization indeed needs to occur (a comment says we need to after blog_id is set), we can clean this up now that we have wp_start_object_cache() in wp-includes/load.php.
It is also missing the site-transients group, so that will fix this.
Hypothetically, we could replace that with wp_start_object_cache() and be done with it, but to save CPU cycles and an unnecessary filesystem check, we should modify wp_start_object_cache() while we're at it.
We can either split the function into two, or first check if wp_cache_init() exists before setting $_wp_using_ext_object_cache, checking for the object-cache.php drop-in, and including either wp-content/object-cache.php or wp-includes/cache.php.
Patch attached with one of these options.",defect (bug),closed,normal,3.0,Multisite,,normal,fixed,has-patch,,