Make WordPress Core

Ticket #25182: 25182.diff

File 25182.diff, 3.8 KB (added by jeremyfelt, 13 years ago)
  • src/wp-admin/includes/schema.php

     
    928928        }
    929929        $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert );
    930930
    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         */
    934936        if ( ! is_multisite() ) {
    935937                $current_site = new stdClass;
    936938                $current_site->domain = $domain;
     
    947949                        $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' );
    948950
    949951                flush_rewrite_rules();
    950         }
    951952
    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;
    961962
    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                        }
    971973                }
    972974        }
    973975