Changeset 41661
- Timestamp:
- 10/02/2017 01:43:48 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/upgrade.php
r41289 r41661 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}'" ); 438 else 439 $wpdb->query( "INSERT INTO {$wpdb->blog_versions} ( `blog_id` , `db_version` , `last_updated` ) VALUES ( '{$wpdb->blogid}', '{$wp_db_version}', NOW());" ); 436 $site_id = get_current_blog_id(); 437 438 if ( $wpdb->get_row( $wpdb->prepare( 'SELECT blog_id FROM %s WHERE blog_id = %d', $wpdb->blog_versions, $site_id ) ) ) { 439 $wpdb->query( $wpdb->prepare( 'UPDATE %s SET db_version = %d WHERE blog_id = %d', $wpdb->blog_versions, $wp_db_version, $site_id ) ); 440 } else { 441 $wpdb->query( $wpdb->prepare( 'INSERT INTO %s ( `blog_id` , `db_version` , `last_updated` ) VALUES ( %d, %d, %s);', $wpdb->blog_versions, $site_id, $wp_db_version, NOW() ) ); 442 } 440 443 } 441 444 … … 1258 1261 $start += 20; 1259 1262 } 1260 refresh_blog_details( $wpdb->blogid);1263 refresh_blog_details(); 1261 1264 } 1262 1265 } -
trunk/src/wp-admin/ms-delete-site.php
r38961 r41661 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 { -
trunk/src/wp-admin/user-new.php
r41225 r41661 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 ) ); -
trunk/src/wp-includes/ms-blogs.php
r41625 r41661 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 21 update_blog_details( $ wpdb->blogid, array('last_updated' => current_time('mysql', true)) );17 $site_id = get_current_blog_id(); 18 19 update_blog_details( $site_id, array( 'last_updated' => current_time( 'mysql', true ) ) ); 22 20 /** 23 21 * Fires after the blog details are updated. … … 27 25 * @param int $blog_id Site ID. 28 26 */ 29 do_action( 'wpmu_blog_updated', $ wpdb->blogid );27 do_action( 'wpmu_blog_updated', $site_id ); 30 28 } 31 29 -
trunk/src/wp-includes/ms-default-constants.php
r38814 r41661 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 23 19 // This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT. 24 20 add_filter( 'default_site_option_ms_files_rewriting', '__return_true' ); … … 34 30 // This is handled in wp_upload_dir() by ignoring UPLOADS for this case. 35 31 if ( ! defined( 'UPLOADS' ) ) { 36 define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" ); 32 $site_id = get_current_blog_id(); 33 34 define( 'UPLOADS', UPLOADBLOGSDIR . '/' . $site_id . '/files/' ); 37 35 38 36 // Uploads dir relative to ABSPATH 39 37 if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) 40 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/");38 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . '/blogs.dir/' . $site_id . '/files/' ); 41 39 } 42 40 } -
trunk/src/wp-includes/ms-functions.php
r41617 r41661 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 if ( !is_multisite() ) 49 return $blogs[$wpdb->blogid]; 45 if ( ! is_multisite() ) { 46 return $blogs[ get_current_blog_id() ]; 47 } 50 48 51 49 $primary_blog = get_user_meta( $user_id, 'primary_blog', true ); … … 2220 2218 $current_user = wp_get_current_user(); 2221 2219 if ( $blog_id == 0 ) { 2222 $blog_id = $wpdb->blogid;2220 $blog_id = get_current_blog_id(); 2223 2221 } 2224 2222 $local_key = $wpdb->get_blog_prefix( $blog_id ) . $key; -
trunk/tests/phpunit/tests/multisite/site.php
r41380 r41661 364 364 365 365 // compare the update time with the current time, allow delta < 2 366 $blog = get_site( $wpdb->blogid);366 $blog = get_site( get_current_blog_id() ); 367 367 $current_time = time(); 368 368 $time_difference = $current_time - strtotime( $blog->last_updated ); -
trunk/tests/phpunit/tests/user/multisite.php
r41255 r41661 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(); … … 150 150 151 151 wp_set_current_user( $user1_id ); 152 $site_id = get_current_blog_id(); 152 153 153 154 $this->assertTrue( is_user_member_of_blog() ); 154 155 $this->assertTrue( is_user_member_of_blog( 0, 0 ) ); 155 $this->assertTrue( is_user_member_of_blog( 0, $ wpdb->blogid ) );156 $this->assertTrue( is_user_member_of_blog( 0, $site_id ) ); 156 157 $this->assertTrue( is_user_member_of_blog( $user1_id ) ); 157 $this->assertTrue( is_user_member_of_blog( $user1_id, $ wpdb->blogid ) );158 $this->assertTrue( is_user_member_of_blog( $user1_id, $site_id ) ); 158 159 159 160 $blog_ids = self::factory()->blog->create_many( 1 );
Note: See TracChangeset
for help on using the changeset viewer.