diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php
index 20853da3ec..9903802c01 100644
a
|
b
|
endif; |
964 | 964 | function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { |
965 | 965 | global $wpdb, $current_site, $wp_rewrite; |
966 | 966 | |
| 967 | $network_args = [ |
| 968 | 'network_id' => $network_id, |
| 969 | 'domain' => $domain, |
| 970 | 'site_name' => $site_name, |
| 971 | 'path' => $path, |
| 972 | 'subdomain_install' => $subdomain_install, |
| 973 | 'email' => $email, |
| 974 | ]; |
| 975 | |
| 976 | /** |
| 977 | * Fires before the populate network. |
| 978 | * |
| 979 | * @since 5.3.0 |
| 980 | * |
| 981 | * @param array $network_args Network args. |
| 982 | */ |
| 983 | do_action( 'before_populate_network', $network_args ); |
| 984 | |
967 | 985 | $errors = new WP_Error(); |
968 | | if ( '' == $domain ) { |
| 986 | if ( '' === $domain ) { |
969 | 987 | $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); |
970 | 988 | } |
971 | | if ( '' == $site_name ) { |
| 989 | if ( '' === $site_name ) { |
972 | 990 | $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); |
973 | 991 | } |
974 | 992 | |
975 | 993 | // Check for network collision. |
976 | | $network_exists = false; |
977 | 994 | if ( is_multisite() ) { |
978 | 995 | if ( get_network( (int) $network_id ) ) { |
979 | 996 | $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
980 | 997 | } |
981 | 998 | } else { |
982 | | if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) { |
| 999 | if ( (int) $network_id === $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) { |
983 | 1000 | $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
984 | 1001 | } |
985 | 1002 | } |
… |
… |
function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam |
992 | 1009 | return $errors; |
993 | 1010 | } |
994 | 1011 | |
995 | | if ( 1 == $network_id ) { |
| 1012 | if ( 1 === (int) $network_id ) { |
996 | 1013 | $wpdb->insert( |
997 | 1014 | $wpdb->site, |
998 | 1015 | array( |
… |
… |
function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam |
1057 | 1074 | |
1058 | 1075 | flush_rewrite_rules(); |
1059 | 1076 | |
| 1077 | /** |
| 1078 | * Fires after the creation of a new multisite instance. |
| 1079 | * |
| 1080 | * @param array $network_args Network args. |
| 1081 | * @param int $site_user->ID ID of the user. |
| 1082 | * |
| 1083 | * @since 5.3.0 |
| 1084 | */ |
| 1085 | do_action( 'after_upgrade_to_multisite', $network_args, $site_user->ID ); |
| 1086 | |
1060 | 1087 | if ( ! $subdomain_install ) { |
1061 | 1088 | return true; |
1062 | 1089 | } |
… |
… |
function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam |
1073 | 1100 | ); |
1074 | 1101 | if ( is_wp_error( $page ) ) { |
1075 | 1102 | $errstr = $page->get_error_message(); |
1076 | | } elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) { |
| 1103 | } elseif ( 200 === wp_remote_retrieve_response_code( $page ) ) { |
1077 | 1104 | $vhost_ok = true; |
1078 | 1105 | } |
1079 | 1106 | |
… |
… |
function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam |
1103 | 1130 | } |
1104 | 1131 | } |
1105 | 1132 | |
| 1133 | /** |
| 1134 | * Fires after the creation of new network. |
| 1135 | * |
| 1136 | * @since 5.3.0 |
| 1137 | * |
| 1138 | * @param array $network_args Network args. |
| 1139 | * @param int $site_user->ID ID of the user. |
| 1140 | */ |
| 1141 | do_action( 'after_populate_network', $network_args, $site_user->ID ); |
| 1142 | |
1106 | 1143 | return true; |
1107 | 1144 | } |
1108 | 1145 | |