Ticket #41507: 41507.2.diff
File 41507.2.diff, 7.7 KB (added by , 7 years ago) |
---|
-
src/wp-admin/includes/ms.php
792 792 * 793 793 * @since 3.1.0 794 794 * 795 * @global wpdb $wpdb WordPress database abstraction object.796 *797 795 * @param int $site_id The network/site ID to check. 798 796 * @return bool True if network can be edited, otherwise false. 799 797 */ 800 798 function can_edit_network( $site_id ) { 801 global $wpdb; 802 803 if ( $site_id == $wpdb->siteid ) 799 if ( $site_id == get_current_network_id() ) 804 800 $result = true; 805 801 else 806 802 $result = false; -
src/wp-includes/ms-blogs.php
1091 1091 if ( ! empty( $deprecated ) ) 1092 1092 _deprecated_argument( __FUNCTION__, 'MU' ); // never used 1093 1093 1094 return $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", $wpdb->siteid, $start, $quantity ) , ARRAY_A );1094 return $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", get_current_network_id(), $start, $quantity ) , ARRAY_A ); 1095 1095 } 1096 1096 1097 1097 /** -
src/wp-includes/ms-deprecated.php
187 187 _deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' ); 188 188 189 189 global $wpdb; 190 $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );190 $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", get_current_network_id()), ARRAY_A ); 191 191 192 192 $blog_list = array(); 193 193 foreach ( (array) $blogs as $details ) { … … 430 430 global $wpdb; 431 431 432 432 if ( ! $sitedomain ) 433 $site_id = $wpdb->siteid;433 $site_id = get_current_network_id(); 434 434 else 435 435 $site_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path ) ); 436 436 … … 447 447 * @deprecated 4.6.0 Use get_sites() 448 448 * @see get_sites() 449 449 * 450 * @global wpdb $wpdb WordPress database abstraction object.451 *452 450 * @param array $args { 453 451 * Array of default arguments. Optional. 454 452 * … … 468 466 * values for whether the site is public, archived, mature, spam, and/or deleted. 469 467 */ 470 468 function wp_get_sites( $args = array() ) { 471 global $wpdb;472 473 469 _deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' ); 474 470 475 471 if ( wp_is_large_network() ) 476 472 return array(); 477 473 478 474 $defaults = array( 479 'network_id' => $wpdb->siteid,475 'network_id' => get_current_network_id(), 480 476 'public' => null, 481 477 'archived' => null, 482 478 'mature' => null, -
src/wp-includes/ms-functions.php
72 72 $ret = false; 73 73 if ( is_array( $blogs ) && count( $blogs ) > 0 ) { 74 74 foreach ( (array) $blogs as $blog_id => $blog ) { 75 if ( $blog->site_id != $wpdb->siteid)75 if ( $blog->site_id != get_current_network_id() ) 76 76 continue; 77 77 $details = get_site( $blog_id ); 78 78 if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) { … … 1089 1089 return array( 'user_id' => $user_id, 'password' => $password, 'meta' => $meta ); 1090 1090 } 1091 1091 1092 $blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid);1092 $blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, get_current_network_id() ); 1093 1093 1094 1094 // TODO: What to do if we create a user but cannot create a blog? 1095 1095 if ( is_wp_error($blog_id) ) { -
src/wp-includes/option.php
223 223 return; 224 224 225 225 if ( empty($site_id) ) 226 $site_id = $wpdb->siteid;226 $site_id = get_current_network_id(); 227 227 228 228 $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' ); 229 229 -
src/wp-signup.php
354 354 * The function halts all execution if the user is not logged in. 355 355 */ 356 356 function validate_another_blog_signup() { 357 global $ wpdb, $blogname, $blog_title, $errors, $domain, $path;357 global $blogname, $blog_title, $errors, $domain, $path; 358 358 $current_user = wp_get_current_user(); 359 359 if ( ! is_user_logged_in() ) { 360 360 die(); … … 422 422 */ 423 423 $meta = apply_filters( 'add_signup_meta', $meta_defaults ); 424 424 425 $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid);425 $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, get_current_network_id() ); 426 426 427 427 if ( is_wp_error( $blog_id ) ) { 428 428 return false; -
tests/phpunit/tests/multisite/network.php
193 193 194 194 // switch_to_network()... 195 195 $orig_network_id = $current_site->id; 196 $orig_wpdb_network_id = $wpdb->siteid;197 196 $current_site->id = self::$different_network_id; 198 $wpdb->siteid = self::$different_network_id;199 197 wp_update_network_site_counts(); 200 198 $current_site->id = $orig_network_id; 201 $wpdb->siteid = $orig_wpdb_network_id;202 199 203 200 $site_count = get_blog_count( self::$different_network_id ); 204 201 … … 216 213 217 214 // switch_to_network()... 218 215 $orig_network_id = $current_site->id; 219 $orig_wpdb_network_id = $wpdb->siteid;220 216 $current_site->id = self::$different_network_id; 221 $wpdb->siteid = self::$different_network_id;222 217 223 218 // Add another user to fake the network user count to be different. 224 219 wpmu_create_user( 'user', 'pass', 'email' ); … … 227 222 228 223 // restore_current_network()... 229 224 $current_site->id = $orig_network_id; 230 $wpdb->siteid = $orig_wpdb_network_id;231 225 232 226 $user_count = get_user_count( self::$different_network_id ); 233 227 -
tests/phpunit/tests/option/multisite.php
148 148 * @group multisite 149 149 */ 150 150 function test_site_notoptions() { 151 global $wpdb;152 $notoptions_key = "{$ wpdb->siteid}:notoptions";151 $network_id = get_current_network_id(); 152 $notoptions_key = "{$network_id}:notoptions"; 153 153 154 154 $_notoptions = wp_cache_get( 'notoptions', 'site-options' ); 155 155 $this->assertEmpty( $_notoptions );