Ticket #41684: 41684-4.patch
File 41684-4.patch, 8.2 KB (added by , 6 years ago) |
---|
-
src/wp-admin/includes/schema.php
38 38 39 39 $charset_collate = $wpdb->get_charset_collate(); 40 40 41 if ( $blog_id && $blog_id != $wpdb->blogid)41 if ( $blog_id && $blog_id != get_current_blog_id() ) 42 42 $old_blog_id = $wpdb->set_blog_id( $blog_id ); 43 43 44 44 // Engage multisite if in the middle of turning it on from network.php. -
src/wp-admin/includes/upgrade.php
433 433 wp_cache_flush(); 434 434 435 435 if ( is_multisite() ) { 436 if ( $wpdb->get_row( "SELECT blog_id FROM {$wpdb->blog_versions} WHERE blog_id = '{$wpdb->blogid}'") )437 $wpdb->query( "UPDATE {$wpdb->blog_versions} SET db_version = '{$wp_db_version}' WHERE blog_id = '{$wpdb->blogid}'");436 if ( $wpdb->get_row( $wpdb->prepare( 'SELECT blog_id FROM %s WHERE blog_id = %d', $wpdb->blog_versions, get_current_blog_id() ) ) ) 437 $wpdb->query( $wpdb->prepare( 'UPDATE %s SET db_version = %d WHERE blog_id = %d', $wpdb->blog_versions, $wp_db_version, get_current_blog_id() ) ); 438 438 else 439 $wpdb->query( "INSERT INTO {$wpdb->blog_versions} ( `blog_id` , `db_version` , `last_updated` ) VALUES ( '{$wpdb->blogid}', '{$wp_db_version}', NOW());");439 $wpdb->query( $wpdb->prepare( 'INSERT INTO %s ( `blog_id` , `db_version` , `last_updated` ) VALUES ( %d, %d, %s);', get_current_blog_id(), $wpdb->blog_versions, $wp_db_version, NOW() ) ); 440 440 } 441 441 442 442 /** … … 1257 1257 } 1258 1258 $start += 20; 1259 1259 } 1260 refresh_blog_details( $wpdb->blogid);1260 refresh_blog_details( get_current_blog_id() ); 1261 1261 } 1262 1262 } 1263 1263 -
src/wp-admin/ms-delete-site.php
17 17 18 18 if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) { 19 19 if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) { 20 wpmu_delete_blog( $wpdb->blogid);20 wpmu_delete_blog( get_current_blog_id() ); 21 21 wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), get_network()->site_name ) ); 22 22 } else { 23 23 wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) ); -
src/wp-admin/user-new.php
156 156 add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email 157 157 add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email 158 158 } 159 wpmu_signup_user( $new_user_login, $new_user_email, array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role'] ) );159 wpmu_signup_user( $new_user_login, $new_user_email, array( 'add_to_blog' => get_current_blog_id(), 'new_role' => $_REQUEST['role'] ) ); 160 160 if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) { 161 161 $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email ) ); 162 162 $new_user = wpmu_activate_signup( $key ); -
src/wp-includes/ms-blogs.php
12 12 * Update the last_updated field for the current site. 13 13 * 14 14 * @since MU (3.0.0) 15 *16 * @global wpdb $wpdb WordPress database abstraction object.17 15 */ 18 16 function wpmu_update_blogs_date() { 19 global $wpdb;20 17 21 update_blog_details( $wpdb->blogid, array('last_updated' => current_time('mysql', true)) );18 update_blog_details( get_current_blog_id(), array('last_updated' => current_time('mysql', true)) ); 22 19 /** 23 20 * Fires after the blog details are updated. 24 21 * … … 26 23 * 27 24 * @param int $blog_id Site ID. 28 25 */ 29 do_action( 'wpmu_blog_updated', $wpdb->blogid);26 do_action( 'wpmu_blog_updated', get_current_blog_id() ); 30 27 } 31 28 32 29 /** -
src/wp-includes/ms-default-constants.php
14 14 * wp-includes/ms-files.php (wp-content/blogs.php in MU). 15 15 * 16 16 * @since 3.0.0 17 *18 * @global wpdb $wpdb WordPress database abstraction object.19 17 */ 20 18 function ms_upload_constants() { 21 global $wpdb;22 19 23 20 // This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT. 24 21 add_filter( 'default_site_option_ms_files_rewriting', '__return_true' ); … … 33 30 // Note, the main site in a post-MU network uses wp-content/uploads. 34 31 // This is handled in wp_upload_dir() by ignoring UPLOADS for this case. 35 32 if ( ! defined( 'UPLOADS' ) ) { 36 define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/");33 define( 'UPLOADS', UPLOADBLOGSDIR . '/' . get_current_blog_id() . '/files/' ); 37 34 38 35 // Uploads dir relative to ABSPATH 39 36 if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) 40 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/");37 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . '/blogs.dir/' . get_current_blog_id() . '/files/' ); 41 38 } 42 39 } 43 40 -
src/wp-includes/ms-functions.php
34 34 * 35 35 * @since MU (3.0.0) 1.0 36 36 * 37 * @global wpdb $wpdb WordPress database abstraction object.38 *39 37 * @param int $user_id The unique ID of the user 40 38 * @return WP_Site|void The blog object 41 39 */ 42 40 function get_active_blog_for_user( $user_id ) { 43 global $wpdb;44 41 $blogs = get_blogs_of_user( $user_id ); 45 42 if ( empty( $blogs ) ) 46 43 return; 47 44 48 45 if ( !is_multisite() ) 49 return $blogs[ $wpdb->blogid];46 return $blogs[get_current_blog_id()]; 50 47 51 48 $primary_blog = get_user_meta( $user_id, 'primary_blog', true ); 52 49 $first_blog = current($blogs); … … 2216 2213 2217 2214 $current_user = wp_get_current_user(); 2218 2215 if ( $blog_id == 0 ) { 2219 $blog_id = $wpdb->blogid;2216 $blog_id = get_current_blog_id(); 2220 2217 } 2221 2218 $local_key = $wpdb->get_blog_prefix( $blog_id ) . $key; 2222 2219 -
tests/phpunit/tests/multisite/site.php
348 348 wpmu_update_blogs_date(); 349 349 350 350 // compare the update time with the current time, allow delta < 2 351 $blog = get_site( $wpdb->blogid);351 $blog = get_site( get_current_blog_id() ); 352 352 $current_time = time(); 353 353 $time_difference = $current_time - strtotime( $blog->last_updated ); 354 354 $this->assertLessThan( 2, $time_difference ); -
tests/phpunit/tests/user/multisite.php
120 120 wp_set_current_user( $user1_id ); 121 121 122 122 $this->assertTrue( is_blog_user() ); 123 $this->assertTrue( is_blog_user( $wpdb->blogid) );123 $this->assertTrue( is_blog_user( get_current_blog_id() ) ); 124 124 125 125 $blog_ids = array(); 126 126 … … 152 152 153 153 $this->assertTrue( is_user_member_of_blog() ); 154 154 $this->assertTrue( is_user_member_of_blog( 0, 0 ) ); 155 $this->assertTrue( is_user_member_of_blog( 0, $wpdb->blogid) );155 $this->assertTrue( is_user_member_of_blog( 0, get_current_blog_id() ) ); 156 156 $this->assertTrue( is_user_member_of_blog( $user1_id ) ); 157 $this->assertTrue( is_user_member_of_blog( $user1_id, $wpdb->blogid) );157 $this->assertTrue( is_user_member_of_blog( $user1_id, get_current_blog_id() ) ); 158 158 159 159 $blog_ids = self::factory()->blog->create_many( 1 ); 160 160 foreach ( $blog_ids as $blog_id ) {