summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-19 12:54:06 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-19 12:54:06 +0000
commitec155f9e7f095def9f6c7cd5db90d05b2c3c9bb4 (patch)
treeddd4effd076e4a73c0b16377329ba3b6411f6897 /wp-includes
parent1d3e07b099f824055d979c9573de4d732370c602 (diff)
downloadwordpress-mu-ec155f9e7f095def9f6c7cd5db90d05b2c3c9bb4.tar.gz
wordpress-mu-ec155f9e7f095def9f6c7cd5db90d05b2c3c9bb4.tar.xz
wordpress-mu-ec155f9e7f095def9f6c7cd5db90d05b2c3c9bb4.zip
Cache get_blog_details() properly. thanks beaulebens, fixes #456
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1111 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/wpmu-functions.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php
index 56884ec..cd2ba8d 100644
--- a/wp-includes/wpmu-functions.php
+++ b/wp-includes/wpmu-functions.php
@@ -143,16 +143,17 @@ function get_user_details( $username ) {
return $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE user_login = '$username'" );
}
-function get_blog_details( $id, $all = true ) {
+function get_blog_details( $id, $getall = true ) {
global $wpdb;
- $details = wp_cache_get( $id, 'blog-details' );
+ $all = $getall == true ? '' : 'short';
+ $details = wp_cache_get( $id . $all, 'blog-details' );
if ( $details ) {
if ( $details == -1 )
return false;
elseif ( !is_object($details) ) // Clear old pre-serialized objects. Cache clients do better with that.
- wp_cache_delete( $id, 'blog-details' );
+ wp_cache_delete( $id . $all, 'blog-details' );
else
return $details;
}
@@ -160,12 +161,12 @@ function get_blog_details( $id, $all = true ) {
$details = $wpdb->get_row( "SELECT * FROM $wpdb->blogs WHERE blog_id = '$id' /* get_blog_details */" );
if ( !$details ) {
- wp_cache_set( $id, -1, 'blog-details' );
+ wp_cache_set( $id . $all, -1, 'blog-details' );
return false;
}
- if ( !$all ) {
- wp_cache_add( $id, $details, 'blog-details' );
+ if ( !$getall ) {
+ wp_cache_add( $id . $all, $details, 'blog-details' );
return $details;
}
@@ -177,7 +178,7 @@ function get_blog_details( $id, $all = true ) {
$details = apply_filters('blog_details', $details);
- wp_cache_set( $id, $details, 'blog-details' );
+ wp_cache_set( $id . $all, $details, 'blog-details' );
$key = md5( $details->domain . $details->path );
wp_cache_set( $key, $details, 'blog-lookup' );