<!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"> &lt;?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 . &quot;/{$wpdb-&gt;blogid}/files/&quot; );
</span><del>-                
</del><ins>+                        /** @since 3.0.0 */
</ins><span class="cx">                         if ( !defined( 'BLOGUPLOADDIR' ) )
</span><span class="cx">                                 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . &quot;/blogs.dir/{$wpdb-&gt;blogid}/files/&quot; );
</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-&gt;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-&gt;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-&gt;site_name) )
-                $current_site-&gt;site_name = get_site_option('site_name');
-
-        if ( $current_site-&gt;site_name == false )
-                $current_site-&gt;site_name = ucfirst( $current_site-&gt;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-&gt;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-&gt;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 &lt;a href=&quot;mailto:%1$s&quot;&gt;%1$s&lt;/a&gt;.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', &quot;support@{$current_site-&gt;domain}&quot; ) ) ) );
</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-&gt;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 &lt;a href=&quot;mailto:%1$s&quot;&gt;%1$s&lt;/a&gt;.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', &quot;support@{$current_site-&gt;domain}&quot; ) ) ) );
+        }
+
</ins><span class="cx">         if ( $current_blog-&gt;archived == '1' || $current_blog-&gt;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-&gt;site_name = wp_cache_get( $current_site-&gt;id . ':current_site_name', &quot;site-options&quot; );
</span><del>-        if ( !$current_site-&gt;site_name ) {
</del><ins>+        if ( ! $current_site-&gt;site_name ) {
</ins><span class="cx">                 $current_site-&gt;site_name = $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT meta_value FROM $wpdb-&gt;sitemeta WHERE site_id = %d AND meta_key = 'site_name'&quot;, $current_site-&gt;id ) );
</span><del>-                if ( $current_site-&gt;site_name == null )
</del><ins>+                if ( ! $current_site-&gt;site_name )
</ins><span class="cx">                         $current_site-&gt;site_name = ucfirst( $current_site-&gt;domain );
</span><del>-                wp_cache_set( $current_site-&gt;id . ':current_site_name', $current_site-&gt;site_name, 'site-options');
</del><ins>+                wp_cache_set( $current_site-&gt;id . ':current_site_name', $current_site-&gt;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' ) &amp;&amp; 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( &quot;current_site&quot;, &quot;site-options&quot; );
</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-&gt;get_results( &quot;SELECT * FROM $wpdb-&gt;site&quot; ); // 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-&gt;path;
</span><del>-                $current_site-&gt;blog_id = $wpdb-&gt;get_var( &quot;SELECT blog_id FROM {$wpdb-&gt;blogs} WHERE domain='{$current_site-&gt;domain}' AND path='{$current_site-&gt;path}'&quot; );
</del><ins>+                $current_site-&gt;blog_id = $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT blog_id FROM $wpdb-&gt;blogs WHERE domain = %s AND path = %s&quot;, $current_site-&gt;domain, $current_site-&gt;path ) );
</ins><span class="cx">                 $current_site = get_current_site_name( $current_site );
</span><span class="cx">                 if ( substr( $current_site-&gt;domain, 0, 4 ) == 'www.' )
</span><span class="cx">                         $current_site-&gt;cookie_domain = substr( $current_site-&gt;domain, 4 );
</span><del>-                wp_cache_set( &quot;current_site&quot;, $current_site, &quot;site-options&quot; );
</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-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;site WHERE domain = %s AND path = %s&quot;, $domain, $path ) );
</del><ins>+                $current_site = $wpdb-&gt;get_row( $wpdb-&gt;prepare( &quot;SELECT * FROM $wpdb-&gt;site WHERE domain = %s AND path = %s&quot;, $domain, $path ) );
</ins><span class="cx">         else
</span><del>-                $current_site = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;site WHERE domain IN ( %s, %s ) AND path = %s ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1&quot;, $domain, $cookie_domain, $path ) );
-        if ( $current_site == null ) {
</del><ins>+                $current_site = $wpdb-&gt;get_row( $wpdb-&gt;prepare( &quot;SELECT * FROM $wpdb-&gt;site WHERE domain IN ( %s, %s ) AND path = %s ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1&quot;, $domain, $cookie_domain, $path ) );
+
+        if ( ! $current_site ) {
</ins><span class="cx">                 if ( $domain == $cookie_domain )
</span><span class="cx">                         $current_site = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;site WHERE domain = %s AND path='/'&quot;, $domain ) );
</span><span class="cx">                 else
</span><span class="cx">                         $current_site = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;site WHERE domain IN ( %s, %s ) AND path = '/' ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1&quot;, $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-&gt;path;
</span><span class="cx">                 $current_site-&gt;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-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;site WHERE domain = %s AND path = %s&quot;, $sitedomain, $path) );
</span><del>-                if ( $current_site != null ) {
</del><ins>+                if ( $current_site ) {
</ins><span class="cx">                         $current_site-&gt;cookie_domain = $current_site-&gt;domain;
</span><span class="cx">                         return $current_site;
</span><span class="cx">                 }
</span><ins>+
</ins><span class="cx">                 $current_site = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;site WHERE domain = %s AND path='/'&quot;, $sitedomain) );
</span><del>-                if ( $current_site == null &amp;&amp; defined( &quot;WP_INSTALLING&quot; ) == false ) {
-                        if ( count( $sites ) == 1 ) {
-                                $current_site = $sites[0];
-                                die( &quot;That blog does not exist. Please try &lt;a href='http://{$current_site-&gt;domain}{$current_site-&gt;path}'&gt;http://{$current_site-&gt;domain}{$current_site-&gt;path}&lt;/a&gt;&quot; );
-                        } else {
-                                die( &quot;No WPMU site defined on this host. If you are the owner of this site, please check &lt;a href='http://codex.wordpress.org/Debugging_WPMU'&gt;Debugging WPMU&lt;/a&gt; for further assistance.&quot; );
-                        }
-                } else {
-                        $path = '/';
-                }
-        } elseif ( defined( &quot;WP_INSTALLING&quot; ) == false ) {
-                if ( count( $sites ) == 1 ) {
-                        $current_site = $sites[0];
-                        die( &quot;That blog does not exist. Please try &lt;a href='http://{$current_site-&gt;domain}{$current_site-&gt;path}'&gt;http://{$current_site-&gt;domain}{$current_site-&gt;path}&lt;/a&gt;&quot; );
-                } else {
-                        die( &quot;No WPMU site defined on this host. If you are the owner of this site, please check &lt;a href='http://codex.wordpress.org/Debugging_WPMU'&gt;Debugging WPMU&lt;/a&gt; for further assistance.&quot; );
-                }
-        } 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 &lt;a href=&quot;%s&quot;&gt;%s&lt;/a&gt;.' ), $sites[0]-&gt;domain . $sites[0]-&gt;path ) );
+        else
+                wp_die( __( 'No site defined on this host. If you are the owner of this site, please check &lt;a href=&quot;http://codex.wordpress.org/Debugging_WPMU&quot;&gt;Debugging WPMU&lt;/a&gt; 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-&gt;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( &quot;WP_INSTALLING&quot; ) == false ) {
-                $check = $wpdb-&gt;get_results( &quot;SELECT * FROM $wpdb-&gt;site&quot; );
-                $msg = &quot;If your blog does not display, please contact the owner of this site.&lt;br /&gt;&lt;br /&gt;If you are the owner of this site please check that MySQL is running properly and all tables are error free.&lt;br /&gt;&lt;br /&gt;&quot;;
-                if ( $check == false ) {
-                        $msg .= &quot;&lt;strong&gt;Database Tables Missing.&lt;/strong&gt;&lt;br /&gt;Database tables are missing. This means that MySQL is either not running, WPMU was not installed properly, or someone deleted {$wpdb-&gt;site}. You really &lt;em&gt;should&lt;/em&gt; look at your database now.&lt;br /&gt;&quot;;
-                } else {
-                        $msg .= '&lt;strong&gt;Could Not Find Blog!&lt;/strong&gt;&lt;br /&gt;';
-                        $msg .= &quot;Searched for &lt;em&gt;&quot; . $domain . $path . &quot;&lt;/em&gt; in &quot; . DB_NAME . &quot;::&quot; . $wpdb-&gt;blogs . &quot; table. Is that right?&lt;br /&gt;&quot;;
-                }
-                $msg .= &quot;&lt;br /&gt;\n&lt;h1&gt;What do I do now?&lt;/h1&gt;&quot;;
-                $msg .= &quot;Read the &lt;a target='_blank' href='http://codex.wordpress.org/Debugging_WPMU'&gt;bug report&lt;/a&gt; page. Some of the guidelines there may help you figure out what went wrong.&lt;br /&gt;&quot;;
-                $msg .= &quot;If you're still stuck with this message, then check that your database contains the following tables:&lt;ul&gt;
-                        &lt;li&gt; $wpdb-&gt;blogs &lt;/li&gt;
-                        &lt;li&gt; $wpdb-&gt;users &lt;/li&gt;
-                        &lt;li&gt; $wpdb-&gt;usermeta &lt;/li&gt;
-                        &lt;li&gt; $wpdb-&gt;site &lt;/li&gt;
-                        &lt;li&gt; $wpdb-&gt;sitemeta &lt;/li&gt;
-                        &lt;li&gt; $wpdb-&gt;sitecategories &lt;/li&gt;
-                        &lt;/ul&gt;&quot;;
-                $msg .= &quot;If you suspect a problem please report it to the support forums but you must include the information asked for in the &lt;a href='http://codex.wordpress.org/Debugging_WPMU'&gt;WPMU bug reporting guidelines&lt;/a&gt;!&lt;br /&gt;&lt;br /&gt;&quot;;
-                if ( is_file( 'release-info.txt' ) ) {
-                        $msg .= 'Your bug report must include the following text: &quot;';
-                        $info = file( 'release-info.txt' );
-                        $msg .= $info[ 4 ] . '&quot;';
-                }
</del><ins>+        if ( defined( 'WP_INSTALLING' ) )
+                return;
</ins><span class="cx"> 
</span><del>-                die( &quot;&lt;h1&gt;Fatal Error&lt;/h1&gt; &quot; . $msg );
</del><ins>+        $msg = '&lt;h1&gt;' . esc_html__( 'Fatal Error' ) . '&lt;/h1&gt;';
+        $msg  = '&lt;p&gt;' . __( 'If your blog does not display, please contact the owner of this site.' ) . '&lt;/p&gt;';
+        $msg .= '&lt;p&gt;' . __( 'If you are the owner of this site please check that MySQL is running properly and all tables are error free.' ) . '&lt;/p&gt;';
+        if ( ! $wpdb-&gt;get_var( &quot;SHOW TABLES LIKE '$wpdb-&gt;site'&quot; ) )
+                $msg .= '&lt;p&gt;' . sprintf( __( '&lt;strong&gt;Database tables are missing.&lt;/strong&gt; This means that MySQL is not running, WordPress was not installed properly, or someone deleted &lt;code&gt;%s&lt;/code&gt;. You really &lt;em&gt;should&lt;/em&gt; look at your database now.' ), $wpdb-&gt;site ) . '&lt;/p&gt;';
+        else
+                $msg .= '&lt;p&gt;' . sprintf( __( '&lt;strong&gt;Could Not Find Blog!&lt;/strong&gt; Searched for table &lt;em&gt;%1$s&lt;/em&gt; in &lt;code&gt;%2$s&lt;/code&gt;. Is that right?' ), $domain . $path, DB_NAME, $wpdb-&gt;blogs ) . '&lt;/p&gt;';
+        $msg .= '&lt;h1&gt;' . esc_html__( 'What do I do now?' ) . '&lt;/h1&gt;';
+        // @todo Update WPMU codex link.
+        $msg .= '&lt;p&gt;' . __( 'Read the &lt;a target=&quot;_blank&quot; href=&quot;http://codex.wordpress.org/Debugging_WPMU&quot;&gt;bug report&lt;/a&gt; page. Some of the guidelines there may help you figure out what went wrong.' ) . '&lt;/p&gt;';
+        $msg .= '&lt;p&gt;' . __( &quot;If you're still stuck with this message, then check that your database contains the following tables:&quot; ) . '&lt;/p&gt;&lt;ul&gt;';
+        foreach ( $wpdb-&gt;global_tables as $table ) {
+                $msg .= '&lt;li&gt;' . $wpdb-&gt;prefix . $table . '&lt;/li&gt;';
</ins><span class="cx">         }
</span><ins>+        $msg .= '&lt;/ul&gt;';
+        // @todo Update WPMU codex link and support instructions.
+        $msg = '&lt;p&gt;' . __( 'If you suspect a problem please report it to the support forums but you must include the information asked for in the &lt;a target=&quot;_blank&quot; href=&quot;http://codex.wordpress.org/Debugging_WPMU&quot;&gt;WPMU bug reporting guidelines&lt;/a&gt;! ' ) . '&lt;/p&gt;';
+
+        // @todo This file no longer exists post-merge.
+        if ( is_file( 'release-info.txt' ) ) {
+                $msg .= '&lt;p&gt;' . __( 'Your bug report must include the following text:' ) . '&lt;/p&gt;';
+                $info = file( 'release-info.txt' );
+                $msg .= $info[ 4 ] . '&quot;';
+        }
+
+        die( $msg );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ?&gt;
</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 != '' &amp;&amp; ! in_array( $blogname, $reserved_blognames ) &amp;&amp; ! 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-&gt;get_row( $wpdb-&gt;prepare( &quot;SELECT * FROM $wpdb-&gt;blogs WHERE domain = %s AND path = %s&quot;, $domain, $path ) );
</span><span class="lines">@@ -81,14 +81,14 @@
</span><span class="cx">         } else {
</span><span class="cx">                 $destination = 'http://' . $current_site-&gt;domain . $current_site-&gt;path . 'wp-signup.php?new=' . str_replace( '.' . $current_site-&gt;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 &amp;&amp; ! $current_blog ) {
</span><span class="cx">                 if ( $current_site-&gt;domain != $_SERVER[ 'HTTP_HOST' ] ) {
</span><del>-                        wp_redirect( 'http://' . $current_site-&gt;domain . $current_site-&gt;path );
</del><ins>+                        header( 'Location: http://' . $current_site-&gt;domain . $current_site-&gt;path );
</ins><span class="cx">                         exit;
</span><span class="cx">                 }
</span><span class="cx">                 $current_blog = $wpdb-&gt;get_row( $wpdb-&gt;prepare( &quot;SELECT * FROM $wpdb-&gt;blogs WHERE domain = %s AND path = %s&quot;, $current_site-&gt;domain, $current_site-&gt;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>