Make WordPress Core

Changeset 13633


Ignore:
Timestamp:
03/09/2010 06:58:05 PM (16 years ago)
Author:
nacin
Message:

Jump right to network.php step 2 when an existing network is present. see #11816

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/network.php

    r13622 r13633  
    8282
    8383        wp_nonce_field( 'install-network-1' );
    84         if ( network_domain_check() ) { ?>
    85                 <h3><?php esc_html_e( 'Existing Network' ); ?></h3>
    86                 <div class="updated inline"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'An existing network was detected.' ); ?></p></div>
    87                 <p class="existing-network">
    88                         <label><input type='checkbox' name='existing_network' value='1' /> <?php _e( 'Yes, keep the existing network of sites.' ); ?></label><br />
    89                 </p>
    90 <?php   } else { ?>
    91                 <input type='hidden' name='existing_network' value='0' />
    92 <?php   } ?>
    93                 <input type='hidden' name='action' value='step2' />
    94 <?php   if ( 'localhost' != $hostname ) : ?>
     84
     85        if ( 'localhost' != $hostname ) : ?>
    9586                <h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3>
    9687                <p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>' ); ?></p>
     
    111102                </table>
    112103
    113                 <?php
    114                 endif;
     104<?php
     105        endif;
    115106
    116107                $is_www = ( substr( $hostname, 0, 4 ) == 'www.' );
     
    172163function network_step2() {
    173164        global $base, $wpdb;
    174 ?>
     165        if ( ! $_POST ) : ?>
     166        <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
     167        <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>
     168<?php endif; ?>
    175169                <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
    176170                <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
     
    252246}
    253247
    254 $action = isset( $_POST['action'] ) ? $_POST['action'] : null;
    255 
    256 switch ( $action ) {
    257         case 'step2':
    258                 check_admin_referer( 'install-network-1' );
    259 
    260                 // Install!
    261                 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
    262 
    263                 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    264                 // create network tables
    265                 install_network();
    266                 $hostname = get_clean_basedomain();
    267                 $vhost = 'localhost' == $hostname ? false : (bool) $_POST['vhost'];
    268                 if ( !network_domain_check() || isset( $_POST['existing_network'] ) && $_POST['existing_network'] == '0' )
    269                         populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $vhost );
    270                 // create wp-config.php / htaccess
    271                 network_step2();
    272                 break;
    273 
    274         default:
    275                 network_step1();
    276                 break;
     248if ( $_POST ) {
     249        check_admin_referer( 'install-network-1' );
     250
     251        // Install!
     252        $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
     253
     254        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     255        // create network tables
     256        install_network();
     257        $hostname = get_clean_basedomain();
     258        $vhost = 'localhost' == $hostname ? false : (bool) $_POST['vhost'];
     259        if ( ! network_domain_check() )
     260                populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $vhost );
     261        // create wp-config.php / htaccess
     262        network_step2();
     263} elseif ( network_domain_check() ) {
     264        network_step2();
     265} else {
     266        network_step1();
    277267}
    278268?>
Note: See TracChangeset for help on using the changeset viewer.