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

git-svn-id: http://svn.automattic.com/wordpress/trunk@13633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-03-09 18:58:05 +00:00
parent 8c9d21d3c5
commit 5648e048c7
1 changed files with 25 additions and 35 deletions

View File

@ -81,17 +81,8 @@ function network_step1() {
}
wp_nonce_field( 'install-network-1' );
if ( network_domain_check() ) { ?>
<h3><?php esc_html_e( 'Existing Network' ); ?></h3>
<div class="updated inline"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'An existing network was detected.' ); ?></p></div>
<p class="existing-network">
<label><input type='checkbox' name='existing_network' value='1' /> <?php _e( 'Yes, keep the existing network of sites.' ); ?></label><br />
</p>
<?php } else { ?>
<input type='hidden' name='existing_network' value='0' />
<?php } ?>
<input type='hidden' name='action' value='step2' />
<?php if ( 'localhost' != $hostname ) : ?>
if ( 'localhost' != $hostname ) : ?>
<h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3>
<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>
<p><?php _e( "You will need a wildcard DNS record if you're going to use the virtual host (sub-domain) functionality." ); ?></p>
@ -110,7 +101,7 @@ function network_step1() {
</tr>
</table>
<?php
<?php
endif;
$is_www = ( substr( $hostname, 0, 4 ) == 'www.' );
@ -171,7 +162,10 @@ function network_step1() {
*/
function network_step2() {
global $base, $wpdb;
?>
if ( ! $_POST ) : ?>
<div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
<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>
<?php endif; ?>
<h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
<p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
<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>
@ -251,10 +245,7 @@ RewriteRule . index.php [L]';
<?php
}
$action = isset( $_POST['action'] ) ? $_POST['action'] : null;
switch ( $action ) {
case 'step2':
if ( $_POST ) {
check_admin_referer( 'install-network-1' );
// Install!
@ -265,15 +256,14 @@ switch ( $action ) {
install_network();
$hostname = get_clean_basedomain();
$vhost = 'localhost' == $hostname ? false : (bool) $_POST['vhost'];
if ( !network_domain_check() || isset( $_POST['existing_network'] ) && $_POST['existing_network'] == '0' )
if ( ! network_domain_check() )
populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $vhost );
// create wp-config.php / htaccess
network_step2();
break;
default:
} elseif ( network_domain_check() ) {
network_step2();
} else {
network_step1();
break;
}
?>
</form>