<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12921] trunk: reorganize code on ms startup.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12921">12921</a></dd>
<dt>Author</dt> <dd>wpmuguru</dd>
<dt>Date</dt> <dd>2010-02-01 20:26:08 +0000 (Mon, 01 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>reorganize code on ms startup. props nacin, see <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesdefaultconstantsphp">trunk/wp-includes/default-constants.php</a></li>
<li><a href="#trunkwpincludesmsdefaultconstantsphp">trunk/wp-includes/ms-default-constants.php</a></li>
<li><a href="#trunkwpincludesmsloadphp">trunk/wp-includes/ms-load.php</a></li>
<li><a href="#trunkwpincludesmssettingsphp">trunk/wp-includes/ms-settings.php</a></li>
<li><a href="#trunkwpsettingsphp">trunk/wp-settings.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesdefaultconstantsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/default-constants.php (12920 => 12921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/default-constants.php        2010-02-01 20:01:14 UTC (rev 12920)
+++ trunk/wp-includes/default-constants.php        2010-02-01 20:26:08 UTC (rev 12921)
</span><span class="lines">@@ -1,5 +1,4 @@
</span><span class="cx"> <?php
</span><del>-
</del><span class="cx"> /**
</span><span class="cx"> * Defines constants and global variables that can be overridden, generally in wp-config.php.
</span><span class="cx"> *
</span><span class="lines">@@ -94,13 +93,11 @@
</span><span class="cx">                          * Allows for the plugins directory to be moved from the default location.
</span><span class="cx">                          *
</span><span class="cx">                          * @since 2.1.0
</span><ins>+                         * @deprecated
</ins><span class="cx">                          */
</span><span class="cx">                         if ( !defined('PLUGINDIR') )
</span><span class="cx">                                 define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
</span><del>-                        break;
</del><span class="cx">
</span><del>-                case 'ms_network_settings_loaded':
-
</del><span class="cx">                         /**
</span><span class="cx">                          * Allows for the mu-plugins directory to be moved from the default location.
</span><span class="cx">                          *
</span><span class="lines">@@ -121,6 +118,7 @@
</span><span class="cx">                          * Allows for the mu-plugins directory to be moved from the default location.
</span><span class="cx">                          *
</span><span class="cx">                          * @since 2.8.0
</span><ins>+                         * @deprecated
</ins><span class="cx">                          */
</span><span class="cx">                         if ( !defined( 'MUPLUGINDIR' ) )
</span><span class="cx">                                 define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
</span><span class="lines">@@ -149,84 +147,72 @@
</span><span class="cx">                         $wp_default_secret_key = 'put your unique phrase here';
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.0.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('USER_COOKIE') )
</span><span class="cx">                                 define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.0.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('PASS_COOKIE') )
</span><span class="cx">                                 define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.5.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('AUTH_COOKIE') )
</span><span class="cx">                                 define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.6.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('SECURE_AUTH_COOKIE') )
</span><span class="cx">                                 define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.6.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('LOGGED_IN_COOKIE') )
</span><span class="cx">                                 define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.3.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('TEST_COOKIE') )
</span><span class="cx">                                 define('TEST_COOKIE', 'wordpress_test_cookie');
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 1.2.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('COOKIEPATH') )
</span><span class="cx">                                 define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 1.5.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('SITECOOKIEPATH') )
</span><span class="cx">                                 define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.6.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('ADMIN_COOKIE_PATH') )
</span><span class="cx">                                 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.6.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('PLUGINS_COOKIE_PATH') )
</span><span class="cx">                                 define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) );
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.0.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('COOKIE_DOMAIN') )
</span><span class="cx">                                 define('COOKIE_DOMAIN', false);
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.6.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('FORCE_SSL_ADMIN') )
</span><span class="lines">@@ -234,7 +220,6 @@
</span><span class="cx">                         force_ssl_admin(FORCE_SSL_ADMIN);
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.6.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('FORCE_SSL_LOGIN') )
</span><span class="lines">@@ -242,14 +227,12 @@
</span><span class="cx">                         force_ssl_login(FORCE_SSL_LOGIN);
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.5.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined( 'AUTOSAVE_INTERVAL' ) )
</span><span class="cx">                                 define( 'AUTOSAVE_INTERVAL', 60 );
</span><span class="cx">
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.9.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined( 'EMPTY_TRASH_DAYS' ) )
</span></span></pre></div>
<a id="trunkwpincludesmsdefaultconstantsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-default-constants.php (12920 => 12921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-default-constants.php        2010-02-01 20:01:14 UTC (rev 12920)
+++ trunk/wp-includes/ms-default-constants.php        2010-02-01 20:26:08 UTC (rev 12921)
</span><span class="lines">@@ -16,33 +16,29 @@
</span><span class="cx">         switch( $context ) {
</span><span class="cx">                 case 'uploads' :
</span><span class="cx">                         global $wpdb;
</span><ins>+                        /** @since 3.0.0 */
</ins><span class="cx">                         if ( !defined( 'UPLOADBLOGSDIR' ) )
</span><span class="cx">                                 define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
</span><del>-                
</del><ins>+                        /** @since 3.0.0 */
</ins><span class="cx">                         if ( !defined( 'UPLOADS' ) )
</span><span class="cx">                                 define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
</span><del>-                
</del><ins>+                        /** @since 3.0.0 */
</ins><span class="cx">                         if ( !defined( 'BLOGUPLOADDIR' ) )
</span><span class="cx">                                 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
</span><span class="cx">                         break;
</span><span class="cx">                 case 'cookies' :
</span><span class="cx">                         global $current_site;
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 1.2.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined( 'COOKIEPATH' ) )
</span><span class="cx">                                         define( 'COOKIEPATH', $current_site->path );
</span><del>-        
</del><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 1.5.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined( 'SITECOOKIEPATH' ) )
</span><span class="cx">                                         define( 'SITECOOKIEPATH', $current_site->path );
</span><del>-        
</del><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.6.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
</span><span class="lines">@@ -53,7 +49,6 @@
</span><span class="cx">                                         }
</span><span class="cx">                         }
</span><span class="cx">                         /**
</span><del>-                         * It is possible to define this in wp-config.php
</del><span class="cx">                          * @since 2.0.0
</span><span class="cx">                          */
</span><span class="cx">                         if ( !defined('COOKIE_DOMAIN') )
</span></span></pre></div>
<a id="trunkwpincludesmsloadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-load.php (12920 => 12921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-load.php        2010-02-01 20:01:14 UTC (rev 12920)
+++ trunk/wp-includes/ms-load.php        2010-02-01 20:26:08 UTC (rev 12921)
</span><span class="lines">@@ -9,7 +9,7 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Whether a subdomain configuration is enabled
</del><ins>+ * Whether a subdomain configuration is enabled.
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.0
</span><span class="cx"> *
</span><span class="lines">@@ -22,16 +22,13 @@
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function ms_network_settings() {
-        global $wpdb, $current_site, $cookiehash;
-
-        if ( !isset($current_site->site_name) )
-                $current_site->site_name = get_site_option('site_name');
-
-        if ( $current_site->site_name == false )
-                $current_site->site_name = ucfirst( $current_site->domain );
-}
-
</del><ins>+/**
+ * Returns array of sitewide plugin files to be included in global scope.
+ *
+ * @access private
+ * @since 3.0.0
+ * @return array Files to include
+ */
</ins><span class="cx"> function ms_network_plugins() {
</span><span class="cx">         $network_plugins = array();
</span><span class="cx">         $deleted_sitewide_plugins = array();
</span><span class="lines">@@ -62,47 +59,76 @@
</span><span class="cx">         return $network_plugins;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/**
+ * Checks status of current blog.
+ *
+ * Checks if the blog is deleted, inactive, archived, or spammed.
+ *
+ * Dies with a default message if the blog does not pass the check.
+ *
+ * To change the default message when a blog does not pass the check,
+ * use the wp-content/blog-deleted.php, blog-inactive.php and
+ * blog-suspended.php drop-ins.
+ *
+ * @return bool|string Returns true on success, or drop-in file to include.
+ */
</ins><span class="cx"> function ms_site_check() {
</span><span class="cx">         global $wpdb, $current_blog;
</span><span class="cx">
</span><span class="cx">         if ( '1' == $current_blog->deleted ) {
</span><del>-                        if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) {
-                                        return WP_CONTENT_DIR . '/blog-deleted.php';
-                        } else {
-                                        header('HTTP/1.1 410 Gone');
-                                        wp_die(__('This user has elected to delete their account and the content is no longer available.'));
-                        }
-        } elseif ( '2' == $current_blog->deleted ) {
-                        if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) )
-                                return WP_CONTENT_DIR . '/blog-inactive.php';
-                        else
-                                wp_die( sprintf( __( 'This blog has not been activated yet. If you are having problems activating your blog, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) );
</del><ins>+                if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) {
+                        return WP_CONTENT_DIR . '/blog-deleted.php';
+                } else {
+                        header( 'HTTP/1.1 410 Gone' );
+                        wp_die( __( 'This user has elected to delete their account and the content is no longer available.' ) );
+                }
</ins><span class="cx">         }
</span><span class="cx">
</span><ins>+        if ( '2' == $current_blog->deleted ) {
+                if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) )
+                        return WP_CONTENT_DIR . '/blog-inactive.php';
+                else
+                        wp_die( sprintf( __( 'This blog has not been activated yet. If you are having problems activating your blog, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) );
+        }
+
</ins><span class="cx">         if ( $current_blog->archived == '1' || $current_blog->spam == '1' ) {
</span><del>-                        if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) {
-                                        return WP_CONTENT_DIR . '/blog-suspended.php';
-                        } else {
-                                        header('HTTP/1.1 410 Gone');
-                                        wp_die(__('This blog has been archived or suspended.'));
-                        }
</del><ins>+                if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) {
+                        return WP_CONTENT_DIR . '/blog-suspended.php';
+                } else {
+                        header( 'HTTP/1.1 410 Gone' );
+                        wp_die( __( 'This blog has been archived or suspended.' ) );
+                }
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/**
+ * Sets current site name.
+ *
+ * @access private
+ * @since 3.0.0
+ * @return object $current_site object with site_name
+ */
</ins><span class="cx"> function get_current_site_name( $current_site ) {
</span><span class="cx">         global $wpdb;
</span><span class="cx">         $current_site->site_name = wp_cache_get( $current_site->id . ':current_site_name', "site-options" );
</span><del>-        if ( !$current_site->site_name ) {
</del><ins>+        if ( ! $current_site->site_name ) {
</ins><span class="cx">                 $current_site->site_name = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $current_site->id ) );
</span><del>-                if ( $current_site->site_name == null )
</del><ins>+                if ( ! $current_site->site_name )
</ins><span class="cx">                         $current_site->site_name = ucfirst( $current_site->domain );
</span><del>-                wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options');
</del><ins>+                wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options' );
</ins><span class="cx">         }
</span><span class="cx">         return $current_site;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/**
+ * Sets current_site object.
+ *
+ * @access private
+ * @since 3.0.0
+ * @return object $current_site object
+ */
</ins><span class="cx"> function wpmu_current_site() {
</span><span class="cx">         global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain;
</span><span class="cx">         if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
</span><span class="lines">@@ -121,99 +147,106 @@
</span><span class="cx">                 return $current_site;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        $current_site = wp_cache_get( "current_site", "site-options" );
</del><ins>+        $current_site = wp_cache_get( 'current_site', 'site-options' );
</ins><span class="cx">         if ( $current_site )
</span><span class="cx">                 return $current_site;
</span><span class="cx">
</span><span class="cx">         $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site
</span><del>-        if ( count( $sites ) == 1 ) {
</del><ins>+        if ( 1 == count( $sites ) ) {
</ins><span class="cx">                 $current_site = $sites[0];
</span><span class="cx">                 $path = $current_site->path;
</span><del>-                $current_site->blog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" );
</del><ins>+                $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) );
</ins><span class="cx">                 $current_site = get_current_site_name( $current_site );
</span><span class="cx">                 if ( substr( $current_site->domain, 0, 4 ) == 'www.' )
</span><span class="cx">                         $current_site->cookie_domain = substr( $current_site->domain, 4 );
</span><del>-                wp_cache_set( "current_site", $current_site, "site-options" );
</del><ins>+                wp_cache_set( 'current_site', $current_site, 'site-options' );
</ins><span class="cx">                 return $current_site;
</span><span class="cx">         }
</span><span class="cx">         $path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) );
</span><span class="cx">
</span><span class="cx">         if ( $domain == $cookie_domain )
</span><del>-                $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) );
</del><ins>+                $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) );
</ins><span class="cx">         else
</span><del>-                $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain IN ( %s, %s ) AND path = %s ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1", $domain, $cookie_domain, $path ) );
-        if ( $current_site == null ) {
</del><ins>+                $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE domain IN ( %s, %s ) AND path = %s ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1", $domain, $cookie_domain, $path ) );
+
+        if ( ! $current_site ) {
</ins><span class="cx">                 if ( $domain == $cookie_domain )
</span><span class="cx">                         $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain ) );
</span><span class="cx">                 else
</span><span class="cx">                         $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain IN ( %s, %s ) AND path = '/' ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1", $domain, $cookie_domain, $path ) );
</span><span class="cx">         }
</span><del>-        if ( $current_site != null ) {
</del><ins>+
+        if ( $current_site ) {
</ins><span class="cx">                 $path = $current_site->path;
</span><span class="cx">                 $current_site->cookie_domain = $cookie_domain;
</span><span class="cx">                 return $current_site;
</span><del>-        } elseif ( is_subdomain_install() ) {
</del><ins>+        }
+        
+        if ( is_subdomain_install() ) {
</ins><span class="cx">                 $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) );
</span><span class="cx">                 $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path) );
</span><del>-                if ( $current_site != null ) {
</del><ins>+                if ( $current_site ) {
</ins><span class="cx">                         $current_site->cookie_domain = $current_site->domain;
</span><span class="cx">                         return $current_site;
</span><span class="cx">                 }
</span><ins>+
</ins><span class="cx">                 $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $sitedomain) );
</span><del>-                if ( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
-                        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>" );
-                        } else {
-                                die( "No WPMU site defined on this host. If you are the owner of this site, please check <a href='http://codex.wordpress.org/Debugging_WPMU'>Debugging WPMU</a> for further assistance." );
-                        }
-                } else {
-                        $path = '/';
-                }
-        } elseif ( defined( "WP_INSTALLING" ) == false ) {
-                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>" );
-                } else {
-                        die( "No WPMU site defined on this host. If you are the owner of this site, please check <a href='http://codex.wordpress.org/Debugging_WPMU'>Debugging WPMU</a> for further assistance." );
-                }
-        } else {
</del><ins>+        }
+
+        if ( $current_site || defined( 'WP_INSTALLING' ) ) {
</ins><span class="cx">                 $path = '/';
</span><ins>+                return $current_site;
</ins><span class="cx">         }
</span><del>-        return $current_site;
</del><ins>+
+        // Still no dice.
+        // @todo Update or remove WPMU codex link.
+        if ( 1 == count( $sites ) )
+                wp_die( sprintf( __( 'That blog does not exist. Please try <a href="%s">%s</a>.' ), $sites[0]->domain . $sites[0]->path ) );
+        else
+                wp_die( __( 'No site defined on this host. If you are the owner of this site, please check <a href="http://codex.wordpress.org/Debugging_WPMU">Debugging WPMU</a> for further assistance.' ) );
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+/**
+ * Displays a failure message when blog does not exist.
+ *
+ * Checks for a missing $wpdb->site table as well.
+ *
+ * @todo Merge with is_blog_installed(), dead_db(), wp_not_installed(), etc.
+ * @access private
+ * @since 3.0.0
+ */
</ins><span class="cx"> function is_installed() {
</span><span class="cx">         global $wpdb, $domain, $path;
</span><span class="cx">         $base = stripslashes( $base );
</span><del>-        if ( defined( "WP_INSTALLING" ) == false ) {
-                $check = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
-                $msg = "If your blog does not display, please contact the owner of this site.<br /><br />If you are the owner of this site please check that MySQL is running properly and all tables are error free.<br /><br />";
-                if ( $check == false ) {
-                        $msg .= "<strong>Database Tables Missing.</strong><br />Database tables are missing. This means that MySQL is either not running, WPMU was not installed properly, or someone deleted {$wpdb->site}. You really <em>should</em> look at your database now.<br />";
-                } else {
-                        $msg .= '<strong>Could Not Find Blog!</strong><br />';
-                        $msg .= "Searched for <em>" . $domain . $path . "</em> in " . DB_NAME . "::" . $wpdb->blogs . " table. Is that right?<br />";
-                }
-                $msg .= "<br />\n<h1>What do I do now?</h1>";
-                $msg .= "Read the <a target='_blank' href='http://codex.wordpress.org/Debugging_WPMU'>bug report</a> page. Some of the guidelines there may help you figure out what went wrong.<br />";
-                $msg .= "If you're still stuck with this message, then check that your database contains the following tables:<ul>
-                        <li> $wpdb->blogs </li>
-                        <li> $wpdb->users </li>
-                        <li> $wpdb->usermeta </li>
-                        <li> $wpdb->site </li>
-                        <li> $wpdb->sitemeta </li>
-                        <li> $wpdb->sitecategories </li>
-                        </ul>";
-                $msg .= "If you suspect a problem please report it to the support forums but you must include the information asked for in the <a href='http://codex.wordpress.org/Debugging_WPMU'>WPMU bug reporting guidelines</a>!<br /><br />";
-                if ( is_file( 'release-info.txt' ) ) {
-                        $msg .= 'Your bug report must include the following text: "';
-                        $info = file( 'release-info.txt' );
-                        $msg .= $info[ 4 ] . '"';
-                }
</del><ins>+        if ( defined( 'WP_INSTALLING' ) )
+                return;
</ins><span class="cx">
</span><del>-                die( "<h1>Fatal Error</h1> " . $msg );
</del><ins>+        $msg = '<h1>' . esc_html__( 'Fatal Error' ) . '</h1>';
+        $msg = '<p>' . __( 'If your blog does not display, please contact the owner of this site.' ) . '</p>';
+        $msg .= '<p>' . __( 'If you are the owner of this site please check that MySQL is running properly and all tables are error free.' ) . '</p>';
+        if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) )
+                $msg .= '<p>' . sprintf( __( '<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted <code>%s</code>. You really <em>should</em> look at your database now.' ), $wpdb->site ) . '</p>';
+        else
+                $msg .= '<p>' . sprintf( __( '<strong>Could Not Find Blog!</strong> Searched for table <em>%1$s</em> in <code>%2$s</code>. Is that right?' ), $domain . $path, DB_NAME, $wpdb->blogs ) . '</p>';
+        $msg .= '<h1>' . esc_html__( 'What do I do now?' ) . '</h1>';
+        // @todo Update WPMU codex link.
+        $msg .= '<p>' . __( 'Read the <a target="_blank" href="http://codex.wordpress.org/Debugging_WPMU">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.' ) . '</p>';
+        $msg .= '<p>' . __( "If you're still stuck with this message, then check that your database contains the following tables:" ) . '</p><ul>';
+        foreach ( $wpdb->global_tables as $table ) {
+                $msg .= '<li>' . $wpdb->prefix . $table . '</li>';
</ins><span class="cx">         }
</span><ins>+        $msg .= '</ul>';
+        // @todo Update WPMU codex link and support instructions.
+        $msg = '<p>' . __( 'If you suspect a problem please report it to the support forums but you must include the information asked for in the <a target="_blank" href="http://codex.wordpress.org/Debugging_WPMU">WPMU bug reporting guidelines</a>! ' ) . '</p>';
+
+        // @todo This file no longer exists post-merge.
+        if ( is_file( 'release-info.txt' ) ) {
+                $msg .= '<p>' . __( 'Your bug report must include the following text:' ) . '</p>';
+                $info = file( 'release-info.txt' );
+                $msg .= $info[ 4 ] . '"';
+        }
+
+        die( $msg );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ?>
</span></span></pre></div>
<a id="trunkwpincludesmssettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-settings.php (12920 => 12921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-settings.php        2010-02-01 20:01:14 UTC (rev 12920)
+++ trunk/wp-includes/ms-settings.php        2010-02-01 20:26:08 UTC (rev 12921)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">                 $blogname = substr( $blogname, 0, strpos( $blogname, '?' ) );
</span><span class="cx">         $reserved_blognames = array( 'page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' );
</span><span class="cx">         if ( $blogname != '' && ! in_array( $blogname, $reserved_blognames ) && ! is_file( $blogname ) )
</span><del>-                $path = $path . $blogname . '/';
</del><ins>+                $path .= $blogname . '/';
</ins><span class="cx">         $current_blog = wp_cache_get( 'current_blog_' . $domain . $path, 'site-options' );
</span><span class="cx">         if ( ! $current_blog ) {
</span><span class="cx">                 $current_blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domain, $path ) );
</span><span class="lines">@@ -81,14 +81,14 @@
</span><span class="cx">         } else {
</span><span class="cx">                 $destination = 'http://' . $current_site->domain . $current_site->path . 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );
</span><span class="cx">         }
</span><del>-        wp_redirect( $destination );
</del><ins>+        header( 'Location: ' . $destination );
</ins><span class="cx">         die();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ( ! defined( 'WP_INSTALLING' ) ) {
</span><span class="cx">         if ( $current_site && ! $current_blog ) {
</span><span class="cx">                 if ( $current_site->domain != $_SERVER[ 'HTTP_HOST' ] ) {
</span><del>-                        wp_redirect( 'http://' . $current_site->domain . $current_site->path );
</del><ins>+                        header( 'Location: http://' . $current_site->domain . $current_site->path );
</ins><span class="cx">                         exit;
</span><span class="cx">                 }
</span><span class="cx">                 $current_blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) );
</span></span></pre></div>
<a id="trunkwpsettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-settings.php (12920 => 12921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-settings.php        2010-02-01 20:01:14 UTC (rev 12920)
+++ trunk/wp-settings.php        2010-02-01 20:26:08 UTC (rev 12921)
</span><span class="lines">@@ -132,15 +132,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Define constants that rely on the API to obtain the default value.
</span><ins>+// Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
</ins><span class="cx"> wp_default_constants( 'wp_included' );
</span><span class="cx">
</span><del>-// Set up multisite if enabled.
-if ( is_multisite() )
-        ms_network_settings();
-
-// Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
-wp_default_constants( 'ms_network_settings_loaded' );
-
</del><span class="cx"> // Load must-use plugins.
</span><span class="cx"> foreach( wp_muplugins_to_load() as $mu_plugin )
</span><span class="cx">         include_once( $mu_plugin );
</span></span></pre>
</div>
</div>
</body>
</html>