Make WordPress Core

Ticket #58423: 58423-2.diff

File 58423-2.diff, 1.7 KB (added by nihar007, 20 months ago)

I made one more changes for this ticket. Removed extra get_userdata function call & moved the query inside is_multisite condition block

  • src/wp-admin/includes/schema.php

    diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php
    index ceb1011462..d78a735cb5 100644
    a b function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam 
    10441044                )
    10451045        );
    10461046
    1047         $site_user = get_userdata(
    1048                 (int) $wpdb->get_var(
    1049                         $wpdb->prepare(
    1050                                 "SELECT meta_value
    1051                                 FROM $wpdb->sitemeta
    1052                                 WHERE meta_key = %s AND site_id = %d",
    1053                                 'admin_user_id',
    1054                                 $network_id
    1055                         )
    1056                 )
    1057         );
    1058 
    10591047        /*
    10601048         * When upgrading from single to multisite, assume the current site will
    10611049         * become the main site of the network. When using populate_network()
    function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam 
    10641052         * created.
    10651053         */
    10661054        if ( ! is_multisite() ) {
     1055                $site_user = (int) $wpdb->get_var(
     1056                        $wpdb->prepare(
     1057                                "SELECT meta_value
     1058                                FROM $wpdb->sitemeta
     1059                                WHERE meta_key = %s AND site_id = %d",
     1060                                'admin_user_id',
     1061                                $network_id
     1062                        )
     1063                );
     1064               
    10671065                $current_site            = new stdClass();
    10681066                $current_site->domain    = $domain;
    10691067                $current_site->path      = $path;
    function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam 
    10791077                        )
    10801078                );
    10811079                $current_site->blog_id = $wpdb->insert_id;
    1082                 update_user_meta( $site_user->ID, 'source_domain', $domain );
    1083                 update_user_meta( $site_user->ID, 'primary_blog', $current_site->blog_id );
     1080                update_user_meta( $site_user, 'source_domain', $domain );
     1081                update_user_meta( $site_user, 'primary_blog', $current_site->blog_id );
    10841082
    10851083                // Unable to use update_network_option() while populating the network.
    10861084                $wpdb->insert(