From a8771a3914df1fac1624724658bdb622772bb0b0 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Sun, 4 Oct 2015 20:51:25 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@34819 git-svn-id: http://core.svn.wordpress.org/trunk@34784 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-network.php | 16 ++++++++++++++++ wp-includes/ms-settings.php | 7 ------- wp-includes/version.php | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/wp-includes/class-wp-network.php b/wp-includes/class-wp-network.php index f40db91883..cb80ead944 100644 --- a/wp-includes/class-wp-network.php +++ b/wp-includes/class-wp-network.php @@ -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. diff --git a/wp-includes/ms-settings.php b/wp-includes/ms-settings.php index 7d0fbc6207..861ee14abf 100644 --- a/wp-includes/ms-settings.php +++ b/wp-includes/ms-settings.php @@ -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(); diff --git a/wp-includes/version.php b/wp-includes/version.php index 1592903c6f..692a82c10a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34818'; +$wp_version = '4.4-alpha-34819'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.