summaryrefslogtreecommitdiffstats
path: root/wpmu-settings.php
diff options
context:
space:
mode:
Diffstat (limited to 'wpmu-settings.php')
-rw-r--r--wpmu-settings.php7
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>" );