| 931 | | // When upgrading from single to multisite, assume the current site will become the main site of the network. |
| 932 | | // When using populate_network() to create another network in an existing multisite environment, |
| 933 | | // skip these steps since the main site of the new network has not yet been created. |
| | 931 | /** |
| | 932 | * When upgrading from single to multisite, assume the current site will become the main site of the network. |
| | 933 | * When using populate_network() to create another network in an existing multisite environment, skip these |
| | 934 | * steps since the main site of the new network has not yet been created. |
| | 935 | */ |
| 952 | | if ( $subdomain_install ) { |
| 953 | | $vhost_ok = false; |
| 954 | | $errstr = ''; |
| 955 | | $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! |
| 956 | | $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); |
| 957 | | if ( is_wp_error( $page ) ) |
| 958 | | $errstr = $page->get_error_message(); |
| 959 | | elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) |
| 960 | | $vhost_ok = true; |
| | 953 | if ( $subdomain_install ) { |
| | 954 | $vhost_ok = false; |
| | 955 | $errstr = ''; |
| | 956 | $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! |
| | 957 | $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); |
| | 958 | if ( is_wp_error( $page ) ) |
| | 959 | $errstr = $page->get_error_message(); |
| | 960 | elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) |
| | 961 | $vhost_ok = true; |
| 962 | | if ( ! $vhost_ok ) { |
| 963 | | $msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>'; |
| 964 | | $msg .= '<p>' . sprintf( __( 'The installer attempted to contact a random hostname (<code>%1$s</code>) on your domain.' ), $hostname ); |
| 965 | | if ( ! empty ( $errstr ) ) |
| 966 | | $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' ); |
| 967 | | $msg .= '</p>'; |
| 968 | | $msg .= '<p>' . __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a <code>*</code> hostname record pointing at your web server in your DNS configuration tool.' ) . '</p>'; |
| 969 | | $msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>'; |
| 970 | | return new WP_Error( 'no_wildcard_dns', $msg ); |
| | 963 | if ( ! $vhost_ok ) { |
| | 964 | $msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>'; |
| | 965 | $msg .= '<p>' . sprintf( __( 'The installer attempted to contact a random hostname (<code>%1$s</code>) on your domain.' ), $hostname ); |
| | 966 | if ( ! empty ( $errstr ) ) |
| | 967 | $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' ); |
| | 968 | $msg .= '</p>'; |
| | 969 | $msg .= '<p>' . __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a <code>*</code> hostname record pointing at your web server in your DNS configuration tool.' ) . '</p>'; |
| | 970 | $msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>'; |
| | 971 | return new WP_Error( 'no_wildcard_dns', $msg ); |
| | 972 | } |