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' ); wp_nonce_field( 'install-network-1' );
if ( network_domain_check() ) { ?>
<h3><?php esc_html_e( 'Existing Network' ); ?></h3> if ( 'localhost' != $hostname ) : ?>
<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 ) : ?>
<h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3> <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( '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> <p><?php _e( "You will need a wildcard DNS record if you're going to use the virtual host (sub-domain) functionality." ); ?></p>
@ -110,8 +101,8 @@ function network_step1() {
</tr> </tr>
</table> </table>
<?php <?php
endif; endif;
$is_www = ( substr( $hostname, 0, 4 ) == 'www.' ); $is_www = ( substr( $hostname, 0, 4 ) == 'www.' );
if ( $is_www ) : if ( $is_www ) :
@ -171,7 +162,10 @@ function network_step1() {
*/ */
function network_step2() { function network_step2() {
global $base, $wpdb; 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> <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> <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> <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,29 +245,25 @@ RewriteRule . index.php [L]';
<?php <?php
} }
$action = isset( $_POST['action'] ) ? $_POST['action'] : null; if ( $_POST ) {
check_admin_referer( 'install-network-1' );
switch ( $action ) { // Install!
case 'step2': $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
check_admin_referer( 'install-network-1' );
// Install! require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
$base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) ); // create network tables
install_network();
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); $hostname = get_clean_basedomain();
// create network tables $vhost = 'localhost' == $hostname ? false : (bool) $_POST['vhost'];
install_network(); if ( ! network_domain_check() )
$hostname = get_clean_basedomain(); populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $vhost );
$vhost = 'localhost' == $hostname ? false : (bool) $_POST['vhost']; // create wp-config.php / htaccess
if ( !network_domain_check() || isset( $_POST['existing_network'] ) && $_POST['existing_network'] == '0' ) network_step2();
populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $vhost ); } elseif ( network_domain_check() ) {
// create wp-config.php / htaccess network_step2();
network_step2(); } else {
break; network_step1();
default:
network_step1();
break;
} }
?> ?>
</form> </form>