diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-07-27 11:25:14 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-07-27 11:25:14 +0000 |
commit | 47ef68e57214c1a4a01fb10daf341d376357e32f (patch) | |
tree | b83aa9a4a75c29e969f8a4d315e48c711a3f9206 /wpmu-settings.php | |
parent | 78db2725b8c18e90779a46c3e1afec52c0821738 (diff) | |
download | wordpress-mu-47ef68e57214c1a4a01fb10daf341d376357e32f.tar.gz wordpress-mu-47ef68e57214c1a4a01fb10daf341d376357e32f.tar.xz wordpress-mu-47ef68e57214c1a4a01fb10daf341d376357e32f.zip |
If there is only one site configured to use this db then skip a lot of needless queries
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@709 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wpmu-settings.php')
-rw-r--r-- | wpmu-settings.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/wpmu-settings.php b/wpmu-settings.php index 43c290f..18c1912 100644 --- a/wpmu-settings.php +++ b/wpmu-settings.php @@ -14,8 +14,12 @@ $path = str_replace ( '/wp-admin/', '/', $path ); $path = preg_replace( '|(/[a-z0-9-]+?/).*|', '$1', $path );
$wpdb->hide_errors();
+$sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site
+if( count( $sites ) == 1 ) {
+ $current_site = $sites[0];
+ $path = $current_site->path;
+}
-
if( isset( $current_site ) == false ) {
$path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) );
if( constant( 'VHOST' ) == 'yes' ) {
@@ -29,7 +33,6 @@ if( isset( $current_site ) == false ) { $path = '/';
$current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$sitedomain' AND path='$path'" );
if( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
- $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
if( count( $sites ) == 1 ) {
$current_site = $sites[0];
die( "That blog does not exist. Please try <a href='http://{$current_site->domain}{$current_site->path}'>http://{$current_site->domain}{$current_site->path}</a>" );
|