Clean up cache re-init code in Multisite. Props nacin. fixes #12065

git-svn-id: http://svn.automattic.com/wordpress/trunk@12888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-01-28 17:28:44 +00:00
parent 6eb6fbf151
commit 394eba5eb1
2 changed files with 11 additions and 12 deletions

View File

@ -318,13 +318,15 @@ function wp_set_wpdb_vars() {
* @since 3.0.0 * @since 3.0.0
*/ */
function wp_start_object_cache() { function wp_start_object_cache() {
global $_wp_using_ext_object_cache; if ( ! function_exists( 'wp_cache_init' ) ) {
if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { global $_wp_using_ext_object_cache;
require_once ( WP_CONTENT_DIR . '/object-cache.php' ); if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
$_wp_using_ext_object_cache = true; require_once ( WP_CONTENT_DIR . '/object-cache.php' );
} else { $_wp_using_ext_object_cache = true;
require_once ( ABSPATH . WPINC . '/cache.php' ); } else {
$_wp_using_ext_object_cache = false; require_once ( ABSPATH . WPINC . '/cache.php' );
$_wp_using_ext_object_cache = false;
}
} }
wp_cache_init(); wp_cache_init();

View File

@ -152,11 +152,8 @@ $PHP_SELF = $_SERVER['PHP_SELF'];
if ( empty($PHP_SELF) || ( empty($PHP_SELF) && !is_subdomain_install() && $current_blog->path != '/' ) ) if ( empty($PHP_SELF) || ( empty($PHP_SELF) && !is_subdomain_install() && $current_blog->path != '/' ) )
$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
wp_cache_init(); // need to init cache again after blog_id is set // 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_start_object_cache();
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' ));
}
ms_default_constants( 'uploads' ); ms_default_constants( 'uploads' );