Multisite: Revert [38388].

Restore `get_current_site()` to a multisite only function. Providing this in single site may be a possibility in the future, but should have a dedicated ticket and discussion.

See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt
2016-09-20 21:39:29 +00:00
parent 2ec9f4b369
commit 58f107fa95
7 changed files with 55 additions and 49 deletions

View File

@@ -1332,7 +1332,8 @@ function insert_blog($domain, $path, $site_id) {
* @param string $blog_title The title of the new site.
*/
function install_blog( $blog_id, $blog_title = '' ) {
global $wpdb, $wp_roles;
global $wpdb, $wp_roles, $current_site;
// Cast for security
$blog_id = (int) $blog_id;
@@ -1360,7 +1361,7 @@ function install_blog( $blog_id, $blog_title = '' ) {
if ( 'https' === parse_url( get_site_option( 'siteurl' ), PHP_URL_SCHEME ) ) {
$siteurl = set_url_scheme( $siteurl, 'https' );
}
if ( 'https' === parse_url( get_home_url( get_current_site()->blog_id ), PHP_URL_SCHEME ) ) {
if ( 'https' === parse_url( get_home_url( $current_site->blog_id ), PHP_URL_SCHEME ) ) {
$home = set_url_scheme( $home, 'https' );
}
@@ -1497,9 +1498,8 @@ We hope you enjoy your new site. Thanks!
$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = $welcome_email;
if ( empty( $current_site->site_name ) ) {
if ( empty( $current_site->site_name ) )
$current_site->site_name = 'WordPress';
}
/**
* Filters the subject of the welcome email after site activation.
@@ -1591,6 +1591,25 @@ function wpmu_welcome_user_notification( $user_id, $password, $meta = array() )
return true;
}
/**
* Get the current network.
*
* Returns an object containing the 'id', 'domain', 'path', and 'site_name'
* properties of the network being viewed.
*
* @see wpmu_current_site()
*
* @since MU
*
* @global WP_Network $current_site
*
* @return WP_Network
*/
function get_current_site() {
global $current_site;
return $current_site;
}
/**
* Get a user's most recent post.
*