Changeset 13641
- Timestamp:
- 03/10/2010 08:17:07 AM (13 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/schema.php
r13636 r13641 621 621 * @param int $network_id id of network to populate 622 622 */ 623 function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $ vhost = 'no') {623 function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { 624 624 global $wpdb, $current_site, $wp_db_version, $wp_rewrite; 625 625 … … 733 733 } 734 734 735 if ( $ vhost == 'yes')735 if ( $subdomain_install ) 736 736 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/'); 737 737 else … … 740 740 $wp_rewrite->flush_rules(); 741 741 742 if ( $ vhost == 'yes') {742 if ( $subdomain_install ) { 743 743 $vhost_ok = false; 744 744 $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! 745 745 $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); 746 if ( is_ object( $page ) && is_wp_error( $page ) ) {746 if ( is_wp_error( $page ) ) { 747 747 foreach ( $page->get_error_messages() as $err ) { 748 748 $errstr = $err; … … 751 751 $vhost_ok = true; 752 752 } 753 if ( ! $vhost_ok ) {753 if ( ! $vhost_ok ) { 754 754 // @todo Update this to reflect the merge. Also: Multisite readme file, or remove the <blockquote> tags. 755 755 $msg = '<h2>' . esc_html__( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</h2>'; -
trunk/wp-admin/network.php
r13638 r13641 99 99 <table class="form-table"> 100 100 <tr> 101 <th><label><input type='radio' name=' vhost' value='yes'<?php checked( $rewrite_enabled ); ?> /> Sub-domains</label></th>101 <th><label><input type='radio' name='subdomain_install' value='1'<?php checked( $rewrite_enabled ); ?> /> Sub-domains</label></th> 102 102 <td><?php _e('like <code>site1.example.com</code> and <code>site2.example.com</code>'); ?></td> 103 103 </tr> 104 104 <tr> 105 <th><label><input type='radio' name=' vhost' value='no'<?php checked( ! $rewrite_enabled ); ?> /> Sub-directories</label></th>105 <th><label><input type='radio' name='subdomain_install' value='0'<?php checked( ! $rewrite_enabled ); ?> /> Sub-directories</label></th> 106 106 <td><?php _e('like <code>example.com/site1</code> and <code>example.com/site2</code>'); ?></td> 107 107 </tr> … … 169 169 function network_step2() { 170 170 global $base, $wpdb; 171 if ( ! $_POST ) : 172 if ( is_multisite() ) : ?> 171 if ( $_POST ) { 172 $vhost = (bool) $_POST['subdomain_install']; 173 } else { 174 if ( is_multisite() ) { 175 $vhost = is_subdomain_install(); 176 ?> 173 177 <div class="updated"><p><strong><?php _e( 'Notice: The Network feature is already enabled.' ); ?></strong> <?php _e( 'The original configuration steps are shown here for reference.' ); ?></p></div> 174 <?php else : ?> 178 <?php } else { 179 $vhost = false; // @todo. 180 ?> 175 181 <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div> 176 182 <p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p> … … 179 185 <div class="updated inline"><p><?php _e( '<strong>Caution:</strong> We recommend you backup your existing <code>wp-config.php</code> and <code>.htaccess</code> files.' ); ?></p></div> 180 186 <?php 181 endif;182 endif;187 } 188 } 183 189 ?> 184 190 <ol> … … 187 193 <textarea class="code" readonly="readonly" cols="100" rows="7"> 188 194 define( 'MULTISITE', true ); 189 define( 'VHOST', '<?php echo ( ! empty( $_POST['vhost'] ) && 'yes' == stripslashes( $_POST['vhost'] ) )? 'yes' : 'no'; ?>' );195 define( 'VHOST', '<?php echo $vhost ? 'yes' : 'no'; ?>' ); 190 196 $base = '<?php echo $base; ?>'; 191 197 define( 'DOMAIN_CURRENT_SITE', '<?php echo get_clean_basedomain(); ?>' ); … … 260 266 } 261 267 268 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) ); 269 262 270 if ( $_POST ) { 263 271 check_admin_referer( 'install-network-1' ); 264 265 // Install!266 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );267 272 268 273 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); … … 270 275 install_network(); 271 276 $hostname = get_clean_basedomain(); 272 $ vhost = 'localhost' == $hostname ? false : (bool) $_POST['vhost'];277 $subdomain_install = 'localhost' == $hostname ? false : (bool) $_POST['subdomain_install']; 273 278 if ( ! network_domain_check() ) 274 populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $ vhost);279 populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $subdomain_install ); 275 280 // create wp-config.php / htaccess 276 281 network_step2();
Note: See TracChangeset
for help on using the changeset viewer.