WordPress.org

Make WordPress Core

Changeset 12688


Ignore:
Timestamp:
01/10/2010 06:10:51 PM (11 years ago)
Author:
wpmuguru
Message:

multi-site startup, See #11644

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-settings.php

    r12685 r12688  
    1010 */
    1111
    12 if ( !defined('WP_MEMORY_LIMIT') )
    13     define('WP_MEMORY_LIMIT', '32M');
     12
     13/**
     14 * Whether Multisite support is enabled
     15 *
     16 * @since 3.0
     17 *
     18 * @return bool True if multisite is enabled, false otherwise.
     19 */
     20function is_multisite() {
     21    if ( ( defined('MULTISITE') && MULTISITE ) || defined('VHOST') || defined('SUNRISE') )
     22        return true;
     23
     24    return false;
     25}
     26
     27if ( !defined('WP_MEMORY_LIMIT') ) {
     28        if( is_multisite() ) {
     29            define('WP_MEMORY_LIMIT', '64M');
     30        } else {
     31            define('WP_MEMORY_LIMIT', '32M');
     32        }
     33}
    1434
    1535if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
     
    326346}
    327347
    328 /**
    329  * Whether Multisite support is enabled
    330  *
    331  * @since 3.0
    332  *
    333  * @return bool True if multisite is enabled, false otherwise.
    334  */
    335 function is_multisite() {
    336     if ( ( defined('MULTISITE') && MULTISITE ) || defined('VHOST') )
    337         return true;
    338 
    339     return false;
    340 }
    341 
    342348if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) {
    343349    require_once (WP_CONTENT_DIR . '/object-cache.php');
     
    350356wp_cache_init();
    351357if ( function_exists('wp_cache_add_global_groups') ) {
    352     wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-transient'));
     358        if( is_multisite() ) {
     359                wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss'));
     360        } else {
     361            wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-transient'));
     362        }
    353363    wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
     364}
     365
     366if( is_multisite() ) {
     367    require (ABSPATH . WPINC . '/ms-load.php');
    354368}
    355369
     
    357371require (ABSPATH . WPINC . '/default-filters.php');
    358372include_once(ABSPATH . WPINC . '/pomo/mo.php');
     373
     374if( is_multisite() && defined( "SHORTINIT" ) && SHORTINIT ) // stop most of WP being loaded, we just want the basics
     375    return false;
     376
    359377require_once (ABSPATH . WPINC . '/l10n.php');
    360378
    361 if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
     379if( is_multisite() ) {
     380        if ( !is_blog_installed() && !defined('WP_INSTALLING') ) {
     381                die( __( 'The blog you have requested is not installed properly. Please contact the system administrator.' ) ); // have to die here ~ Mark
     382        }
     383} elseif ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
    362384    if ( defined('WP_SITEURL') )
    363385        $link = WP_SITEURL . '/wp-admin/install.php';
     
    438460    define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.
    439461
     462if( is_multisite() )
     463        ms_network_settings();
    440464/**
    441465 * Allows for the mu-plugins directory to be moved from the default location.
     
    464488if ( is_dir( WPMU_PLUGIN_DIR ) ) {
    465489    if ( $dh = opendir( WPMU_PLUGIN_DIR ) ) {
    466         while ( ( $plugin = readdir( $dh ) ) !== false ) {
    467             if ( substr( $plugin, -4 ) == '.php' ) {
    468                 include_once( WPMU_PLUGIN_DIR . '/' . $plugin );
    469             }
    470         }
     490        $mu_plugins = array ();
     491        while ( ( $plugin = readdir( $dh ) ) !== false )
     492            if ( substr( $plugin, -4 ) == '.php' )
     493                $mu_plugins[] = $plugin;
     494        closedir( $dh );
     495                if( is_multisite() )
     496                sort( $mu_plugins );
     497        foreach( $mu_plugins as $mu_plugin )
     498            include_once( WPMU_PLUGIN_DIR . '/' . $mu_plugin );
    471499    }
    472500}
     501/**
     502 * Used to load network wide plugins
     503 * @since 3.0
     504 */
     505if( is_multisite() )
     506        ms_network_plugins();
     507
    473508do_action('muplugins_loaded');
    474509
     510/**
     511 * Used to check site status
     512 * @since 3.0
     513 */
     514if( is_multisite() ) {
     515    ms_site_check();
     516    ms_network_cookies();
     517}
    475518/**
    476519 * Used to guarantee unique hash cookies
    477520 * @since 1.5
    478521 */
    479 define('COOKIEHASH', md5(get_option('siteurl')));
     522if( !defined('COOKIEHASH') )
     523        define('COOKIEHASH', md5(get_option('siteurl')));
    480524
    481525/**
Note: See TracChangeset for help on using the changeset viewer.