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:
parent
3c5115f15f
commit
5a76e8be5d
|
@ -125,13 +125,16 @@ function get_blog_details( $fields, $get_all = true ) {
|
||||||
|
|
||||||
if ( $details ) {
|
if ( $details ) {
|
||||||
if ( ! is_object( $details ) ) {
|
if ( ! is_object( $details ) ) {
|
||||||
if ( $details == -1 )
|
if ( $details == -1 ) {
|
||||||
return false;
|
return false;
|
||||||
else
|
} else {
|
||||||
// Clear old pre-serialized objects. Cache clients do better with that.
|
// Clear old pre-serialized objects. Cache clients do better with that.
|
||||||
wp_cache_delete( $blog_id . $all, 'blog-details' );
|
wp_cache_delete( $blog_id . $all, 'blog-details' );
|
||||||
|
unset($details);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $details;
|
||||||
}
|
}
|
||||||
return $details;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try the other cache.
|
// 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 short was requested and full cache is set, we can return.
|
||||||
if ( $details ) {
|
if ( $details ) {
|
||||||
if ( ! is_object( $details ) ) {
|
if ( ! is_object( $details ) ) {
|
||||||
if ( $details == -1 )
|
if ( $details == -1 ) {
|
||||||
return false;
|
return false;
|
||||||
else
|
} else {
|
||||||
// Clear old pre-serialized objects. Cache clients do better with that.
|
// 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 ) {
|
if ( empty($details) ) {
|
||||||
$details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE blog_id = %d", $blog_id ) );
|
$details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE blog_id = %d /* get_blog_details */", $blog_id ) );
|
||||||
if ( ! $details ) {
|
if ( ! $details ) {
|
||||||
// Set the full cache.
|
// Set the full cache.
|
||||||
wp_cache_set( $blog_id, -1, 'blog-details' );
|
wp_cache_set( $blog_id, -1, 'blog-details' );
|
||||||
|
|
Loading…
Reference in New Issue