Changeset 709

Show
Ignore:
Timestamp:
07/27/06 11:25:14 (2 years ago)
Author:
donncha
Message:

If there is only one site configured to use this db then skip a lot of needless queries

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wpmu-settings.php

    r675 r709  
    1515 
    1616$wpdb->hide_errors(); 
     17$sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site 
     18if( count( $sites ) == 1 ) { 
     19        $current_site = $sites[0]; 
     20        $path = $current_site->path; 
     21} 
    1722 
    18          
    1923if( isset( $current_site ) == false ) { 
    2024        $path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) ); 
     
    3034                                        $current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$sitedomain' AND path='$path'" ); 
    3135                                        if( $current_site == null && defined( "WP_INSTALLING" ) == false ) { 
    32                                                 $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); 
    3336                                                if( count( $sites ) == 1 ) { 
    3437                                                        $current_site = $sites[0];