MS: Populate site_name property in a new WP_Network.

This allows us to reduce some extra handling in `ms-settings.php`. Requires [34777].

Props johnjamesjacoby for the initial patch.
See #31985.


git-svn-id: https://develop.svn.wordpress.org/trunk@34819 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt 2015-10-04 20:50:48 +00:00
parent f5066a38f2
commit bb8ca3bd5f
2 changed files with 16 additions and 7 deletions

View File

@ -129,9 +129,25 @@ class WP_Network {
$this->$key = $value;
}
$this->_set_site_name();
$this->_set_cookie_domain();
}
/**
* Set the site name assigned to the network if one has not been populated.
*
* @since 4.4.0
* @access private
*/
private function _set_site_name() {
if ( ! empty( $this->site_name ) ) {
return;
}
$default = ucfirst( $this->domain );
$this->site_name = get_network_option( 'site_name', $default, $this->id );
}
/**
* Set the cookie domain based on the network domain if one has
* not been populated.

View File

@ -221,12 +221,5 @@ if ( ! $current_site instanceof WP_Network ) {
$current_site = new WP_Network( $current_site );
}
if ( empty( $current_site->site_name ) ) {
$current_site->site_name = get_network_option( 'site_name' );
if ( ! $current_site->site_name ) {
$current_site->site_name = ucfirst( $current_site->domain );
}
}
// Define upload directory constants
ms_upload_constants();