WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/13/2010 11:09:54 PM (12 years ago)
Author:
ryan
Message:

Add ability to query by domain and/or path to get_blog_details(). Improve blog details caching. Use get_blog_details() in ms-settings.php so queries are cached. see #11644

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-settings.php

    r13065 r13126  
    4949    $current_blog = wp_cache_get( 'current_blog_' . $domain, 'site-options' );
    5050    if ( !$current_blog ) {
    51         $current_blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $domain ) );
     51        $current_blog = get_blog_details( array('domain' => $domain), false );
    5252        if ( $current_blog )
    5353            wp_cache_set( 'current_blog_' . $domain, $current_blog, 'site-options' );
     
    6868    $current_blog = wp_cache_get( 'current_blog_' . $domain . $path, 'site-options' );
    6969    if ( ! $current_blog ) {
    70         $current_blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domain, $path ) );
     70        $current_blog = $current_blog = get_blog_details( array('domain' => $domain, 'path' => $path ), false );
    7171        if ( $current_blog )
    7272            wp_cache_set( 'current_blog_' . $domain . $path, $current_blog, 'site-options' );
     
    9292            exit;
    9393        }
    94         $current_blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) );
     94        $current_blog = get_blog_details( array('domain' => $current_site->domain, 'path' => $current_site->path), false );
    9595    }
    9696    if ( ! $current_blog || ! $current_site )
Note: See TracChangeset for help on using the changeset viewer.