Changeset 34097
- Timestamp:
- 09/13/2015 11:30:57 PM (9 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-load.php
r33999 r34097 259 259 * 260 260 * @since 3.9.0 261 * 262 * @global wpdb $wpdb 261 * @since 4.4.0 Converted to leverage WP_Network 263 262 * 264 263 * @param object|int $network The network's database row or ID. 265 * @return object|false Object containing network information if found, false if not.264 * @return WP_Network|false Object containing network information if found, false if not. 266 265 */ 267 266 function wp_get_network( $network ) { 268 global $wpdb;269 270 267 if ( ! is_object( $network ) ) { 271 $network = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE id = %d", $network ) ); 272 if ( ! $network ) { 273 return false; 274 } 268 $network = WP_Network::get_instance( $network ); 269 } else { 270 $network = new WP_Network( $network ); 275 271 } 276 272 -
trunk/src/wp-includes/ms-settings.php
r33990 r34097 11 11 */ 12 12 13 /** Include Multisite initialization functions */ 13 /** WP_Network class */ 14 require_once( ABSPATH . WPINC . '/class-wp-network.php' ); 15 16 /** Multisite loader */ 14 17 require_once( ABSPATH . WPINC . '/ms-load.php' ); 18 19 /** Default Multisite constants */ 15 20 require_once( ABSPATH . WPINC . '/ms-default-constants.php' ); 16 21 … … 76 81 $one_network = $wpdb->get_row( "SELECT * FROM $wpdb->site LIMIT 2" ); // [sic] 77 82 if ( 1 === $wpdb->num_rows ) { 78 $current_site = wp_get_network( $one_network );83 $current_site = new WP_Network( $one_network ); 79 84 wp_cache_add( 'current_network', $current_site, 'site-options' ); 80 85 } elseif ( 0 === $wpdb->num_rows ) { … … 111 116 $current_blog = get_site_by_path( $domain, $path, 1 ); 112 117 if ( $current_blog ) { 113 $current_site = wp_get_network( $current_blog->site_id ? $current_blog->site_id : 1 );118 $current_site = WP_Network::get_instance( $current_blog->site_id ? $current_blog->site_id : 1 ); 114 119 } else { 115 120 // If you don't have a site with the same domain/path as a network, you're pretty screwed, but: … … 120 125 // The network declared by the site trumps any constants. 121 126 if ( $current_blog && $current_blog->site_id != $current_site->id ) { 122 $current_site = wp_get_network( $current_blog->site_id );127 $current_site = WP_Network::get_instance( $current_blog->site_id ); 123 128 } 124 129 … … 180 185 } 181 186 182 // @todo What if the domain of the network doesn't match the current site?183 $current_site->cookie_domain = $current_site->domain;184 if ( 'www.' === substr( $current_site->cookie_domain, 0, 4 ) ) {185 $current_site->cookie_domain = substr( $current_site->cookie_domain, 4 );186 }187 188 187 // Figure out the current network's main site. 189 if ( ! isset( $current_site->blog_id ) ) {188 if ( empty( $current_site->blog_id ) ) { 190 189 if ( $current_blog->domain === $current_site->domain && $current_blog->path === $current_site->path ) { 191 190 $current_site->blog_id = $current_blog->blog_id; … … 219 218 wp_start_object_cache(); 220 219 221 if ( ! isset( $current_site->site_name ) ) { 220 if ( ! $current_site instanceof WP_Network ) { 221 $current_site = new WP_Network( $current_site ); 222 } 223 224 if ( empty( $current_site->site_name ) ) { 222 225 $current_site->site_name = get_site_option( 'site_name' ); 223 226 if ( ! $current_site->site_name ) {
Note: See TracChangeset
for help on using the changeset viewer.