Make WordPress Core

Changeset 12885


Ignore:
Timestamp:
01/28/2010 04:09:52 PM (14 years ago)
Author:
wpmuguru
Message:

rearrage multisite initialization, remove deprecated $wpmuBaseTablePrefix, props nacin, see #11881

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/load.php

    r12880 r12885  
    11<?php
    2 
    32/**
    43 * These functions are needed to load WordPress.
  • trunk/wp-includes/ms-deprecated.php

    r12868 r12885  
    1515/**
    1616 * @since unknown
    17  * @deprecated 3.0
     17 * @deprecated 3.0.0
    1818 * @deprecated Use wp_generate_password()
    1919 * @see wp_generate_password()
     
    2121function generate_random_password( $len = 8 ) {
    2222    _deprecated_function( __FUNCTION__, '3.0', 'wp_generate_password()' );
    23     return wp_generate_password($len);
     23    return wp_generate_password( $len );
    2424}
    2525
     
    3333 * legacy function_exists() checks to determine if multisite is enabled.
    3434 *
    35  * @since unknown
    36  * @deprecated 3.0
     35 * @since MU
     36 * @deprecated 3.0.0
    3737 * @deprecated Use is_super_admin()
    3838 * @see is_super_admin()
     
    5757}
    5858
    59 if ( !function_exists('graceful_fail') ) :
     59if ( !function_exists( 'graceful_fail' ) ) :
    6060/**
    61  * @deprecated 3.0
     61 * @since MU
     62 * @deprecated 3.0.0
     63 * @deprecated Use wp_die()
     64 * @see wp_die()
    6265 */
    6366function graceful_fail( $message ) {
    6467    _deprecated_function( __FUNCTION__, '3.0', 'wp_die()' );
    65     $message = apply_filters('graceful_fail', $message);
     68    $message = apply_filters( 'graceful_fail', $message );
    6669    $message_template = apply_filters( 'graceful_fail_template',
    6770'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    9396
    9497/**
    95  * @deprecated 3.0
     98 * @since MU
     99 * @deprecated 3.0.0
     100 * @deprecated Use $GLOBALS['current_user']->ID
    96101 */
    97102function get_current_user_id() {
    98     _deprecated_function( __FUNCTION__, '3.0', '' );
    99 
    100     global $current_user;
    101     return $current_user->ID;
     103    _deprecated_function( __FUNCTION__, '3.0', '$GLOBALS\'current_user\']->ID' );
     104    return $GLOBALS['current_user']->ID;
    102105}
    103106
    104107/**
    105  * @deprecated 3.0
     108 * @since MU
     109 * @deprecated 3.0.0
     110 * @deprecated Use get_user_by()
     111 * @see get_user_by()
    106112 */
    107113function get_user_details( $username ) {
    108114    _deprecated_function( __FUNCTION__, '3.0', 'get_user_by()' );
    109 
    110115    return get_user_by('login', $username);
    111116}
    112117
    113118/**
    114  * @deprecated 3.0
     119 * @since MU
     120 * @deprecated 3.0.0
     121 * @deprecated Use clean_post_cache()
     122 * @see clean_post_cache()
    115123 */
    116124function clear_global_post_cache( $post_id ) {
    117     _deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache' );
     125    _deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache()' );
    118126}
    119127
    120128/**
    121  * @deprecated 3.0
     129 * @since MU
     130 * @deprecated 3.0.0
     131 * @deprecated Use is_main_site()
     132 * @see is_main_site()
    122133 */
    123134function is_main_blog() {
    124     _deprecated_function( __FUNCTION__, '3.0', 'is_main_site' );
     135    _deprecated_function( __FUNCTION__, '3.0', 'is_main_site()' );
    125136    return is_main_site();
    126137}
    127138
    128139/**
    129  * @deprecated 3.0
     140 * @since MU
     141 * @deprecated 3.0.0
     142 * @deprecated Use is_email()
     143 * @see is_email()
    130144 */
    131145function validate_email( $email, $check_domain = true) {
  • trunk/wp-includes/ms-load.php

    r12836 r12885  
    11<?php
    22/**
    3  * Used to setup and fix common variables and include
    4  * the WordPress procedural and class library.
    5  *
    6  * You should not have to change this file and allows
    7  * for some configuration in wp-config.php.
     3 * These functions are needed to load Multisite.
     4 *
     5 * @since 3.0.0
     6 *
     7 * @package WordPress
     8 * @subpackage Multisite
     9 */
     10
     11/**
     12 * Whether a subdomain configuration is enabled
    813 *
    914 * @since 3.0
    1015 *
    11  * @package WordPress
     16 * @return bool True if subdomain configuration is enabled, false otherwise.
    1217 */
    13 if ( defined( 'SUNRISE' ) )
    14     include_once( WP_CONTENT_DIR . '/sunrise.php' );
    15 
    16 require( ABSPATH . WPINC . '/ms-settings.php' );
    17 $wpdb->blogid = $current_blog->blog_id;
    18 $wpdb->siteid = $current_blog->site_id;
    19 $wpdb->set_prefix($table_prefix); // set up blog tables
    20 $table_prefix = $wpdb->get_blog_prefix();
    21 
    22 // Fix empty PHP_SELF
    23 $PHP_SELF = $_SERVER['PHP_SELF'];
    24 if ( empty($PHP_SELF) || ( empty($PHP_SELF) && !is_subdomain_install() && $current_blog->path != '/' ) )
    25     $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
    26 
    27 wp_cache_init(); // need to init cache again after blog_id is set
    28 if ( function_exists('wp_cache_add_global_groups') ) { // need to add these again. Yes, it's an ugly hack
    29     wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss'));
    30     wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
    31 }
    32 
    33 if ( !defined( 'UPLOADBLOGSDIR' ) )
    34     define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
    35 
    36 if ( !defined( 'UPLOADS' ) )
    37     define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
    38 
    39 if ( !defined( 'BLOGUPLOADDIR' ) )
    40     define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
     18function is_subdomain_install() {
     19    if ( defined('VHOST') && VHOST == 'yes' )
     20        return true;
     21
     22    return false;
     23}
    4124
    4225function ms_network_settings() {
     
    11396}
    11497
    115 function ms_network_cookies() {
    116     global $current_site;
    117     /**
    118      * It is possible to define this in wp-config.php
    119      * @since 1.2.0
    120      */
    121     if ( !defined( 'COOKIEPATH' ) )
    122             define( 'COOKIEPATH', $current_site->path );
    123 
    124     /**
    125      * It is possible to define this in wp-config.php
    126      * @since 1.5.0
    127      */
    128     if ( !defined( 'SITECOOKIEPATH' ) )
    129             define( 'SITECOOKIEPATH', $current_site->path );
    130 
    131     /**
    132      * It is possible to define this in wp-config.php
    133      * @since 2.6.0
    134      */
    135     if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
    136             if( !is_subdomain_install() ) {
    137                     define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
     98function get_current_site_name( $current_site ) {
     99    global $wpdb;
     100    $current_site->site_name = wp_cache_get( $current_site->id . ':current_site_name', "site-options" );
     101    if ( !$current_site->site_name ) {
     102        $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 ) );
     103        if ( $current_site->site_name == null )
     104            $current_site->site_name = ucfirst( $current_site->domain );
     105        wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options');
     106    }
     107    return $current_site;
     108}
     109
     110function wpmu_current_site() {
     111    global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain;
     112    if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
     113        $current_site->id = (defined( 'SITE_ID_CURRENT_SITE' ) ? constant('SITE_ID_CURRENT_SITE') : 1);
     114        $current_site->domain = DOMAIN_CURRENT_SITE;
     115        $current_site->path   = $path = PATH_CURRENT_SITE;
     116        if ( defined( 'BLOGID_CURRENT_SITE' ) )
     117            $current_site->blog_id = BLOGID_CURRENT_SITE;
     118        if ( DOMAIN_CURRENT_SITE == $domain )
     119            $current_site->cookie_domain = $cookie_domain;
     120        elseif ( substr( $current_site->domain, 0, 4 ) == 'www.' )
     121            $current_site->cookie_domain = substr( $current_site->domain, 4 );
     122        else
     123            $current_site->cookie_domain = $current_site->domain;
     124
     125        return $current_site;
     126    }
     127
     128    $current_site = wp_cache_get( "current_site", "site-options" );
     129    if ( $current_site )
     130        return $current_site;
     131
     132    $wpdb->suppress_errors();
     133    $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site
     134    if ( count( $sites ) == 1 ) {
     135        $current_site = $sites[0];
     136        $path = $current_site->path;
     137        $current_site->blog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" );
     138        $current_site = get_current_site_name( $current_site );
     139        if ( substr( $current_site->domain, 0, 4 ) == 'www.' )
     140            $current_site->cookie_domain = substr( $current_site->domain, 4 );
     141        wp_cache_set( "current_site", $current_site, "site-options" );
     142        return $current_site;
     143    }
     144    $path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) );
     145
     146    if ( $domain == $cookie_domain )
     147        $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) );
     148    else
     149        $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 ) );
     150    if ( $current_site == null ) {
     151        if ( $domain == $cookie_domain )
     152            $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain ) );
     153        else
     154            $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 ) );
     155    }
     156    if ( $current_site != null ) {
     157        $path = $current_site->path;
     158        $current_site->cookie_domain = $cookie_domain;
     159        return $current_site;
     160    } elseif ( is_subdomain_install() ) {
     161        $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) );
     162        $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path) );
     163        if ( $current_site != null ) {
     164            $current_site->cookie_domain = $current_site->domain;
     165            return $current_site;
     166        }
     167        $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $sitedomain) );
     168        if ( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
     169            if ( count( $sites ) == 1 ) {
     170                $current_site = $sites[0];
     171                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>" );
    138172            } else {
    139                     define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
     173                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." );
    140174            }
    141     }
    142     /**
    143      * It is possible to define this in wp-config.php
    144      * @since 2.0.0
    145      */
    146     if ( !defined('COOKIE_DOMAIN') )
    147             define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);
    148 }
     175        } else {
     176            $path = '/';
     177        }
     178    } elseif ( defined( "WP_INSTALLING" ) == false ) {
     179        if ( count( $sites ) == 1 ) {
     180            $current_site = $sites[0];
     181            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>" );
     182        } else {
     183            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." );
     184        }
     185    } else {
     186        $path = '/';
     187    }
     188    return $current_site;
     189}
     190
     191function is_installed() {
     192    global $wpdb, $domain, $path;
     193    $base = stripslashes( $base );
     194    if ( defined( "WP_INSTALLING" ) == false ) {
     195        $check = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
     196        $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 />";
     197        if ( $check == false ) {
     198            $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 />";
     199        } else {
     200            $msg .= '<strong>Could Not Find Blog!</strong><br />';
     201            $msg .= "Searched for <em>" . $domain . $path . "</em> in " . DB_NAME . "::" . $wpdb->blogs . " table. Is that right?<br />";
     202        }
     203        $msg .= "<br />\n<h1>What do I do now?</h1>";
     204        $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 />";
     205        $msg .= "If you're still stuck with this message, then check that your database contains the following tables:<ul>
     206            <li> $wpdb->blogs </li>
     207            <li> $wpdb->users </li>
     208            <li> $wpdb->usermeta </li>
     209            <li> $wpdb->site </li>
     210            <li> $wpdb->sitemeta </li>
     211            <li> $wpdb->sitecategories </li>
     212            </ul>";
     213        $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 />";
     214        if ( is_file( 'release-info.txt' ) ) {
     215            $msg .= 'Your bug report must include the following text: "';
     216            $info = file( 'release-info.txt' );
     217            $msg .= $info[ 4 ] . '"';
     218        }
     219
     220        die( "<h1>Fatal Error</h1> " . $msg );
     221    }
     222}
     223
    149224?>
  • trunk/wp-includes/ms-settings.php

    r12858 r12885  
    11<?php
     2/**
     3 * Used to setup and fix common variables and include
     4 * the Multisite procedural and class library.
     5 *
     6 * Allows for some configuration in wp-config.php (see ms-default-constants.php)
     7 *
     8 * @package WordPress
     9 * @subpackage Multisite
     10 */
    211
    3 /**
    4  * Whether a subdomain configuration is enabled
    5  *
    6  * @since 3.0
    7  *
    8  * @return bool True if subdomain configuration is enabled, false otherwise.
    9  */
    10 function is_subdomain_install() {
    11     if ( defined('VHOST') && VHOST == 'yes' )
    12         return true;
     12/** Include Multisite initialization functions */
     13require( ABSPATH . WPINC . '/ms-load.php' );
     14require( ABSPATH . WPINC . '/ms-default-constants.php' );
    1315
    14     return false;
    15 }
     16if ( defined( 'SUNRISE' ) )
     17    include_once( WP_CONTENT_DIR . '/sunrise.php' );
    1618
    1719if ( isset( $current_site ) && isset( $current_blog ) )
    1820    return;
    19 
    20 // deprecated
    21 $wpmuBaseTablePrefix = $table_prefix;
    2221
    2322$domain = addslashes( $_SERVER['HTTP_HOST'] );
     
    4544$path = str_replace ( '/wp-admin/', '/', $path );
    4645$path = preg_replace( '|(/[a-z0-9-]+?/).*|', '$1', $path );
    47 
    48 function get_current_site_name( $current_site ) {
    49     global $wpdb;
    50     $current_site->site_name = wp_cache_get( $current_site->id . ':current_site_name', "site-options" );
    51     if ( !$current_site->site_name ) {
    52         $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 ) );
    53         if ( $current_site->site_name == null )
    54             $current_site->site_name = ucfirst( $current_site->domain );
    55         wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options');
    56     }
    57     return $current_site;
    58 }
    59 
    60 function wpmu_current_site() {
    61     global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain;
    62     if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
    63         $current_site->id = (defined( 'SITE_ID_CURRENT_SITE' ) ? constant('SITE_ID_CURRENT_SITE') : 1);
    64         $current_site->domain = DOMAIN_CURRENT_SITE;
    65         $current_site->path   = $path = PATH_CURRENT_SITE;
    66         if ( defined( 'BLOGID_CURRENT_SITE' ) )
    67             $current_site->blog_id = BLOGID_CURRENT_SITE;
    68         if ( DOMAIN_CURRENT_SITE == $domain )
    69             $current_site->cookie_domain = $cookie_domain;
    70         elseif ( substr( $current_site->domain, 0, 4 ) == 'www.' )
    71             $current_site->cookie_domain = substr( $current_site->domain, 4 );
    72         else
    73             $current_site->cookie_domain = $current_site->domain;
    74 
    75         return $current_site;
    76     }
    77 
    78     $current_site = wp_cache_get( "current_site", "site-options" );
    79     if ( $current_site )
    80         return $current_site;
    81 
    82     $wpdb->suppress_errors();
    83     $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site
    84     if ( count( $sites ) == 1 ) {
    85         $current_site = $sites[0];
    86         $path = $current_site->path;
    87         $current_site->blog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" );
    88         $current_site = get_current_site_name( $current_site );
    89         if ( substr( $current_site->domain, 0, 4 ) == 'www.' )
    90             $current_site->cookie_domain = substr( $current_site->domain, 4 );
    91         wp_cache_set( "current_site", $current_site, "site-options" );
    92         return $current_site;
    93     }
    94     $path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) );
    95 
    96     if ( $domain == $cookie_domain )
    97         $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) );
    98     else
    99         $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 ) );
    100     if ( $current_site == null ) {
    101         if ( $domain == $cookie_domain )
    102             $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain ) );
    103         else
    104             $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 ) );
    105     }
    106     if ( $current_site != null ) {
    107         $path = $current_site->path;
    108         $current_site->cookie_domain = $cookie_domain;
    109         return $current_site;
    110     } elseif ( is_subdomain_install() ) {
    111         $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) );
    112         $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path) );
    113         if ( $current_site != null ) {
    114             $current_site->cookie_domain = $current_site->domain;
    115             return $current_site;
    116         }
    117         $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $sitedomain) );
    118         if ( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
    119             if ( count( $sites ) == 1 ) {
    120                 $current_site = $sites[0];
    121                 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>" );
    122             } else {
    123                 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." );
    124             }
    125         } else {
    126             $path = '/';
    127         }
    128     } elseif ( defined( "WP_INSTALLING" ) == false ) {
    129         if ( count( $sites ) == 1 ) {
    130             $current_site = $sites[0];
    131             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>" );
    132         } else {
    133             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." );
    134         }
    135     } else {
    136         $path = '/';
    137     }
    138     return $current_site;
    139 }
    14046
    14147$current_site = wpmu_current_site();
     
    17177}
    17278
    173 if ( defined( "WP_INSTALLING" ) == false && is_subdomain_install() && !is_object( $current_blog ) ) {
     79if ( ! defined( 'WP_INSTALLING' ) && is_subdomain_install() && !is_object( $current_blog ) ) {
     80
    17481    if ( defined( 'NOBLOGREDIRECT' ) ) {
    17582        $destination = constant( 'NOBLOGREDIRECT' );
     
    18592}
    18693
    187 if ( defined( "WP_INSTALLING" ) == false ) {
     94if ( ! defined( 'WP_INSTALLING' ) ) {
    18895    if ( $current_site && $current_blog == null ) {
    18996        if ( $current_site->domain != $_SERVER[ 'HTTP_HOST' ] ) {
     
    236143}
    237144
    238 function is_installed() {
    239     global $wpdb, $domain, $path;
    240     $base = stripslashes( $base );
    241     if ( defined( "WP_INSTALLING" ) == false ) {
    242         $check = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
    243         $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 />";
    244         if ( $check == false ) {
    245             $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 />";
    246         } else {
    247             $msg .= '<strong>Could Not Find Blog!</strong><br />';
    248             $msg .= "Searched for <em>" . $domain . $path . "</em> in " . DB_NAME . "::" . $wpdb->blogs . " table. Is that right?<br />";
    249         }
    250         $msg .= "<br />\n<h1>What do I do now?</h1>";
    251         $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 />";
    252         $msg .= "If you're still stuck with this message, then check that your database contains the following tables:<ul>
    253             <li> $wpdb->blogs </li>
    254             <li> $wpdb->users </li>
    255             <li> $wpdb->usermeta </li>
    256             <li> $wpdb->site </li>
    257             <li> $wpdb->sitemeta </li>
    258             <li> $wpdb->sitecategories </li>
    259             </ul>";
    260         $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 />";
    261         if ( is_file( 'release-info.txt' ) ) {
    262             $msg .= 'Your bug report must include the following text: "';
    263             $info = file( 'release-info.txt' );
    264             $msg .= $info[ 4 ] . '"';
    265         }
     145$wpdb->blogid = $current_blog->blog_id;
     146$wpdb->siteid = $current_blog->site_id;
     147$wpdb->set_prefix($table_prefix); // set up blog tables
     148$table_prefix = $wpdb->get_blog_prefix();
    266149
    267         die( "<h1>Fatal Error</h1> " . $msg );
    268     }
     150// Fix empty PHP_SELF
     151$PHP_SELF = $_SERVER['PHP_SELF'];
     152if ( empty($PHP_SELF) || ( empty($PHP_SELF) && !is_subdomain_install() && $current_blog->path != '/' ) )
     153    $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
     154
     155wp_cache_init(); // need to init cache again after blog_id is set
     156if ( function_exists('wp_cache_add_global_groups') ) { // need to add these again. Yes, it's an ugly hack
     157    wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss'));
     158    wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
    269159}
    270160
     161ms_default_constants( 'uploads' );
     162
    271163?>
  • trunk/wp-settings.php

    r12847 r12885  
    7676// Initialize multisite if enabled.
    7777if ( is_multisite() )
    78     require( ABSPATH . WPINC . '/ms-load.php' );
     78    require( ABSPATH . WPINC . '/ms-settings.php' );
    7979
    8080// Load early WordPress files.
     
    163163    }
    164164    unset($file);
    165     ms_network_cookies();
     165    ms_default_constants( 'cookies' );
    166166}
    167167
Note: See TracChangeset for help on using the changeset viewer.