From 62569595aa90c1935de10007943ba62e34460340 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 10 Mar 2010 08:17:07 +0000 Subject: [PATCH] Correct subdomain handling in network.php. Pass around boolean values instead of 'yes' and 'no'. see #11816 git-svn-id: https://develop.svn.wordpress.org/trunk@13641 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/schema.php | 10 +++++----- wp-admin/network.php | 31 ++++++++++++++++++------------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index 1f0dc4699c..875caf4614 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -620,7 +620,7 @@ function populate_roles_300() { * * @param int $network_id id of network to populate */ -function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $vhost = 'no' ) { +function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { global $wpdb, $current_site, $wp_db_version, $wp_rewrite; $msg = ''; @@ -732,25 +732,25 @@ Thanks! } } - if ( $vhost == 'yes' ) + if ( $subdomain_install ) update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/'); else update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/'); $wp_rewrite->flush_rules(); - if ( $vhost == 'yes' ) { + if ( $subdomain_install ) { $vhost_ok = false; $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); - if ( is_object( $page ) && is_wp_error( $page ) ) { + if ( is_wp_error( $page ) ) { foreach ( $page->get_error_messages() as $err ) { $errstr = $err; } } elseif( $page[ 'response' ][ 'code' ] == 200 ) { $vhost_ok = true; } - if ( !$vhost_ok ) { + if ( ! $vhost_ok ) { // @todo Update this to reflect the merge. Also: Multisite readme file, or remove the
tags. $msg = '

' . esc_html__( 'Warning! Wildcard DNS may not be configured correctly!' ) . '

'; $msg .= '

' . __( 'To use the subdomain feature of WordPress MU you must have a wildcard entry in your dns. The installer attempted to contact a random hostname ($hostname) on your domain but failed. It returned this error message:' ) . '
'; diff --git a/wp-admin/network.php b/wp-admin/network.php index 76e6b4e104..8b31268fc5 100644 --- a/wp-admin/network.php +++ b/wp-admin/network.php @@ -98,11 +98,11 @@ function network_step1() { - + - +
site1.example.com and site2.example.com'); ?>
example.com/site1 and example.com/site2'); ?>
@@ -168,25 +168,31 @@ function network_step1() { */ function network_step2() { global $base, $wpdb; - if ( ! $_POST ) : - if ( is_multisite() ) : ?> + if ( $_POST ) { + $vhost = (bool) $_POST['subdomain_install']; + } else { + if ( is_multisite() ) { + $vhost = is_subdomain_install(); +?>

- +

Caution: We recommend you backup your existing wp-config.php and .htaccess files.' ); ?>

  1. blogs.dir directory in %s. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR ); ?>

  2. wp-config.php file in %s:' ), ABSPATH ); ?>