Make $blog_id explicitly global.

`$blog_id` is used in both single and multisite configurations as a global variable, though has never been explicitly marked as such in the global scope. This can cause confusion depending on how core is loaded.

Fixes #34217.

Built from https://develop.svn.wordpress.org/trunk@34961


git-svn-id: http://core.svn.wordpress.org/trunk@34926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt 2015-10-08 21:45:25 +00:00
parent e147ba60b0
commit 554b1425ed
3 changed files with 12 additions and 8 deletions

View File

@ -11,6 +11,8 @@
* @see wp_debug_mode()
*
* @since 3.0.0
*
* @global int $blog_id
*/
function wp_initial_constants() {
global $blog_id;
@ -28,13 +30,6 @@ function wp_initial_constants() {
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
}
/**
* The $blog_id global, which you can change in the config allows you to create a simple
* multiple blog installation using just one WordPress and changing $blog_id around.
*
* @global int $blog_id
* @since 2.0.0
*/
if ( ! isset($blog_id) )
$blog_id = 1;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34960';
$wp_version = '4.4-alpha-34961';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -29,6 +29,15 @@ require( ABSPATH . WPINC . '/default-constants.php' );
global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version;
require( ABSPATH . WPINC . '/version.php' );
/**
* If not already configured, `$blog_id` will default to 1 in a single site
* configuration. In multisite, it will be overridden by default in ms-settings.php.
*
* @global int $blog_id
* @since 2.0.0
*/
global $blog_id;
// Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, SCRIPT_DEBUG, WP_CONTENT_DIR and WP_CACHE.
wp_initial_constants();