Multisite: Replace unnecessary `is_super_admin()` check when setting up the initial network.
When using `is_super_admin()` in a non-multisite environment, the function is supposed to check for administrator capabilities. The process of querying all users and filtering them with that function can be optimized by only querying users with the administrator role instead. Fixes #40406. See #37616. Built from https://develop.svn.wordpress.org/trunk@40406 git-svn-id: http://core.svn.wordpress.org/trunk@40313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
226e34effc
commit
45b64ba2ff
|
@ -951,12 +951,16 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
|
|||
|
||||
if ( !is_multisite() ) {
|
||||
$site_admins = array( $site_user->user_login );
|
||||
$users = get_users( array( 'fields' => array( 'ID', 'user_login' ) ) );
|
||||
$users = get_users( array(
|
||||
'fields' => array( 'user_login' ),
|
||||
'role' => 'administrator',
|
||||
) );
|
||||
if ( $users ) {
|
||||
foreach ( $users as $user ) {
|
||||
if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) )
|
||||
$site_admins[] = $user->user_login;
|
||||
$site_admins[] = $user->user_login;
|
||||
}
|
||||
|
||||
$site_admins = array_unique( $site_admins );
|
||||
}
|
||||
} else {
|
||||
$site_admins = get_site_option( 'site_admins' );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.8-alpha-40405';
|
||||
$wp_version = '4.8-alpha-40406';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue