mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-30 20:21:37 +01:00
Upgrade/Install: Avoid an extra database query in populate_network()
.
This moves the query for user ID of the new network's administrator closer to where the value is actually used. Includes removing unnecessary `get_userdata()` call, as user ID is the only data needed here. Follow-up to [12756], [35575], [43628]. Props nihar007, sakibmd, mukesh27, costdev, SergeyBiryukov. Fixes #58423. Built from https://develop.svn.wordpress.org/trunk@55869 git-svn-id: http://core.svn.wordpress.org/trunk@55381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6d16bbc088
commit
37e599fb3e
@ -1044,18 +1044,6 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
|
||||
)
|
||||
);
|
||||
|
||||
$site_user = get_userdata(
|
||||
(int) $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT meta_value
|
||||
FROM $wpdb->sitemeta
|
||||
WHERE meta_key = %s AND site_id = %d",
|
||||
'admin_user_id',
|
||||
$network_id
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* When upgrading from single to multisite, assume the current site will
|
||||
* become the main site of the network. When using populate_network()
|
||||
@ -1079,8 +1067,19 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
|
||||
)
|
||||
);
|
||||
$current_site->blog_id = $wpdb->insert_id;
|
||||
update_user_meta( $site_user->ID, 'source_domain', $domain );
|
||||
update_user_meta( $site_user->ID, 'primary_blog', $current_site->blog_id );
|
||||
|
||||
$site_user_id = (int) $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT meta_value
|
||||
FROM $wpdb->sitemeta
|
||||
WHERE meta_key = %s AND site_id = %d",
|
||||
'admin_user_id',
|
||||
$network_id
|
||||
)
|
||||
);
|
||||
|
||||
update_user_meta( $site_user_id, 'source_domain', $domain );
|
||||
update_user_meta( $site_user_id, 'primary_blog', $current_site->blog_id );
|
||||
|
||||
// Unable to use update_network_option() while populating the network.
|
||||
$wpdb->insert(
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.3-alpha-55868';
|
||||
$wp_version = '6.3-alpha-55869';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user