Edit File by line
/home/barbar84/www/wp-inclu...
File: ms-settings.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Used to set up and fix common variables and include
[2] Fix | Delete
* the Multisite procedural and class library.
[3] Fix | Delete
*
[4] Fix | Delete
* Allows for some configuration in wp-config.php (see ms-default-constants.php)
[5] Fix | Delete
*
[6] Fix | Delete
* @package WordPress
[7] Fix | Delete
* @subpackage Multisite
[8] Fix | Delete
* @since 3.0.0
[9] Fix | Delete
*/
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Objects representing the current network and current site.
[13] Fix | Delete
*
[14] Fix | Delete
* These may be populated through a custom `sunrise.php`. If not, then this
[15] Fix | Delete
* file will attempt to populate them based on the current request.
[16] Fix | Delete
*
[17] Fix | Delete
* @global WP_Network $current_site The current network.
[18] Fix | Delete
* @global object $current_blog The current site.
[19] Fix | Delete
* @global string $domain Deprecated. The domain of the site found on load.
[20] Fix | Delete
* Use `get_site()->domain` instead.
[21] Fix | Delete
* @global string $path Deprecated. The path of the site found on load.
[22] Fix | Delete
* Use `get_site()->path` instead.
[23] Fix | Delete
* @global int $site_id Deprecated. The ID of the network found on load.
[24] Fix | Delete
* Use `get_current_network_id()` instead.
[25] Fix | Delete
* @global bool $public Deprecated. Whether the site found on load is public.
[26] Fix | Delete
* Use `get_site()->public` instead.
[27] Fix | Delete
*
[28] Fix | Delete
* @since 3.0.0
[29] Fix | Delete
*/
[30] Fix | Delete
global $current_site, $current_blog, $domain, $path, $site_id, $public;
[31] Fix | Delete
[32] Fix | Delete
/** WP_Network class */
[33] Fix | Delete
require_once ABSPATH . WPINC . '/class-wp-network.php';
[34] Fix | Delete
[35] Fix | Delete
/** WP_Site class */
[36] Fix | Delete
require_once ABSPATH . WPINC . '/class-wp-site.php';
[37] Fix | Delete
[38] Fix | Delete
/** Multisite loader */
[39] Fix | Delete
require_once ABSPATH . WPINC . '/ms-load.php';
[40] Fix | Delete
[41] Fix | Delete
/** Default Multisite constants */
[42] Fix | Delete
require_once ABSPATH . WPINC . '/ms-default-constants.php';
[43] Fix | Delete
[44] Fix | Delete
if ( defined( 'SUNRISE' ) ) {
[45] Fix | Delete
include_once WP_CONTENT_DIR . '/sunrise.php';
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
/** Check for and define SUBDOMAIN_INSTALL and the deprecated VHOST constant. */
[49] Fix | Delete
ms_subdomain_constants();
[50] Fix | Delete
[51] Fix | Delete
// This block will process a request if the current network or current site objects
[52] Fix | Delete
// have not been populated in the global scope through something like `sunrise.php`.
[53] Fix | Delete
if ( ! isset( $current_site ) || ! isset( $current_blog ) ) {
[54] Fix | Delete
[55] Fix | Delete
$domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) );
[56] Fix | Delete
if ( ':80' === substr( $domain, -3 ) ) {
[57] Fix | Delete
$domain = substr( $domain, 0, -3 );
[58] Fix | Delete
$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );
[59] Fix | Delete
} elseif ( ':443' === substr( $domain, -4 ) ) {
[60] Fix | Delete
$domain = substr( $domain, 0, -4 );
[61] Fix | Delete
$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
$path = stripslashes( $_SERVER['REQUEST_URI'] );
[65] Fix | Delete
if ( is_admin() ) {
[66] Fix | Delete
$path = preg_replace( '#(.*)/wp-admin/.*#', '$1/', $path );
[67] Fix | Delete
}
[68] Fix | Delete
list( $path ) = explode( '?', $path );
[69] Fix | Delete
[70] Fix | Delete
$bootstrap_result = ms_load_current_site_and_network( $domain, $path, is_subdomain_install() );
[71] Fix | Delete
[72] Fix | Delete
if ( true === $bootstrap_result ) {
[73] Fix | Delete
// `$current_blog` and `$current_site are now populated.
[74] Fix | Delete
} elseif ( false === $bootstrap_result ) {
[75] Fix | Delete
ms_not_installed( $domain, $path );
[76] Fix | Delete
} else {
[77] Fix | Delete
header( 'Location: ' . $bootstrap_result );
[78] Fix | Delete
exit;
[79] Fix | Delete
}
[80] Fix | Delete
unset( $bootstrap_result );
[81] Fix | Delete
[82] Fix | Delete
$blog_id = $current_blog->blog_id;
[83] Fix | Delete
$public = $current_blog->public;
[84] Fix | Delete
[85] Fix | Delete
if ( empty( $current_blog->site_id ) ) {
[86] Fix | Delete
// This dates to [MU134] and shouldn't be relevant anymore,
[87] Fix | Delete
// but it could be possible for arguments passed to insert_blog() etc.
[88] Fix | Delete
$current_blog->site_id = 1;
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
$site_id = $current_blog->site_id;
[92] Fix | Delete
wp_load_core_site_options( $site_id );
[93] Fix | Delete
}
[94] Fix | Delete
[95] Fix | Delete
$wpdb->set_prefix( $table_prefix, false ); // $table_prefix can be set in sunrise.php.
[96] Fix | Delete
$wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id );
[97] Fix | Delete
$table_prefix = $wpdb->get_blog_prefix();
[98] Fix | Delete
$_wp_switched_stack = array();
[99] Fix | Delete
$switched = false;
[100] Fix | Delete
[101] Fix | Delete
// Need to init cache again after blog_id is set.
[102] Fix | Delete
wp_start_object_cache();
[103] Fix | Delete
[104] Fix | Delete
if ( ! $current_site instanceof WP_Network ) {
[105] Fix | Delete
$current_site = new WP_Network( $current_site );
[106] Fix | Delete
}
[107] Fix | Delete
[108] Fix | Delete
if ( ! $current_blog instanceof WP_Site ) {
[109] Fix | Delete
$current_blog = new WP_Site( $current_blog );
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
// Define upload directory constants.
[113] Fix | Delete
ms_upload_constants();
[114] Fix | Delete
[115] Fix | Delete
/**
[116] Fix | Delete
* Fires after the current site and network have been detected and loaded
[117] Fix | Delete
* in multisite's bootstrap.
[118] Fix | Delete
*
[119] Fix | Delete
* @since 4.6.0
[120] Fix | Delete
*/
[121] Fix | Delete
do_action( 'ms_loaded' );
[122] Fix | Delete
[123] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function