Cache fixes for get_blog_details()

git-svn-id: http://svn.automattic.com/wordpress/trunk@14076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-04-13 12:43:40 +00:00
parent 3c5115f15f
commit 5a76e8be5d
1 changed files with 15 additions and 9 deletions

View File

@ -125,13 +125,16 @@ function get_blog_details( $fields, $get_all = true ) {
if ( $details ) {
if ( ! is_object( $details ) ) {
if ( $details == -1 )
if ( $details == -1 ) {
return false;
else
} else {
// Clear old pre-serialized objects. Cache clients do better with that.
wp_cache_delete( $blog_id . $all, 'blog-details' );
unset($details);
}
} else {
return $details;
}
return $details;
}
// Try the other cache.
@ -142,18 +145,21 @@ function get_blog_details( $fields, $get_all = true ) {
// If short was requested and full cache is set, we can return.
if ( $details ) {
if ( ! is_object( $details ) ) {
if ( $details == -1 )
if ( $details == -1 ) {
return false;
else
} else {
// Clear old pre-serialized objects. Cache clients do better with that.
wp_cache_delete( $blog_id . $all, 'blog-details' );
wp_cache_delete( $blog_id, 'blog-details' );
unset($details);
}
} else {
return $details;
}
return $details;
}
}
if ( !$details ) {
$details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE blog_id = %d", $blog_id ) );
if ( empty($details) ) {
$details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE blog_id = %d /* get_blog_details */", $blog_id ) );
if ( ! $details ) {
// Set the full cache.
wp_cache_set( $blog_id, -1, 'blog-details' );