Changeset 13000 for trunk/wp-admin/network.php
- Timestamp:
- 02/07/2010 02:13:20 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/network.php
r12910 r13000 97 97 wp_die( sprintf( __( 'Sorry, I need to be able to read %s. Please check the permissions on this file.' ), $htaccess_sample ) ); 98 98 } 99 100 //@todo: check for super-cache in use101 99 ?> 102 100 <li><p><?php _e( 'Replace the contents of your <code>.htaccess</code> with the following:' ); ?></p> … … 158 156 159 157 wp_nonce_field( 'install-network-1' ); 160 ?> 158 if ( network_domain_check() ) { ?> 159 <h2><?php esc_html_e( 'Existing Sites' ); ?></h2> 160 <p><?php _e( 'An existing WordPress Network was detected.' ); ?></p> 161 <p class="existing-network"> 162 <label><input type='checkbox' name='existing_network' value='yes' /> <?php _e( 'Yes, keep the existing network of sites.' ); ?></label><br /> 163 </p> 164 165 <?php } else { ?> 166 <input type='hidden' name='existing_network' value='none' /> 167 <?php } ?> 161 168 <input type='hidden' name='action' value='step2' /> 162 169 <h2><?php esc_html_e( 'Site Addresses' ); ?></h2> … … 212 219 213 220 /** 221 * Checks for active plugins & displays a notice to deactivate them. 222 * 223 * @since 3.0.0 224 */ 225 function step1_plugin_check() { 226 $active_plugins = get_option( 'active_plugins' ); 227 if ( is_array( $active_plugins ) && !empty( $active_plugins ) ) { 228 ?> 229 <h2><?php esc_html_e( 'Enabling WordPress Sites' ); ?></h2> 230 <p><?php printf( __( 'Please <a href="%s">deactivate</a> your plugins before enabling WordPress Sites. Once WordPress Sites are enabled, you may reactivate your plugins.' ), admin_url( 'plugins.php' ) ); ?></p> 231 <?php 232 return false; 233 } 234 return true; 235 } 236 237 /** 238 * Checks for existing network data/tables. 239 * 240 * @since 3.0.0 241 */ 242 function network_domain_check() { 243 global $wpdb; 244 245 if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) == $wpdb->site ) 246 return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" ); 247 248 return false; 249 } 250 251 /** 214 252 * Prints step 2 for network settings. 215 253 * … … 309 347 function get_clean_basedomain() { 310 348 global $wpdb; 349 350 $existing_domain = network_domain_check(); 351 if ( $existing_domain ) 352 return $existing_domain; 353 311 354 $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); 312 355 if ( strpos( $domain, '/' ) ) … … 321 364 check_admin_referer( 'install-network-1' ); 322 365 323 // Install! 324 $base = stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ); 325 if ( $base != '/' ) 326 $base .= '/'; 327 328 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 329 // create network tables 330 $domain = get_clean_basedomain(); 331 install_network(); 332 populate_network( 1, $domain, sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $_POST['vhost'] ); 333 // create wp-config.php / htaccess 334 step2(); 335 break; 366 if ( isset( $_POST[ 'existing_network' ] ) ) { 367 // Install! 368 $base = stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ); 369 if ( $base != '/' ) 370 $base .= '/'; 371 372 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 373 // create network tables 374 $domain = get_clean_basedomain(); 375 install_network(); 376 if ( !network_domain_check() || $_POST[ 'existing_network' ] == 'none' ) 377 populate_network( 1, $domain, sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $_POST['vhost'] ); 378 // create wp-config.php / htaccess 379 step2(); 380 break; 381 } 336 382 default: 337 383 //@todo: give an informative screen instead 338 384 if ( is_multisite() ) { 339 385 _e( 'Network already enabled.' ); 340 } else {386 } elseif ( step1_plugin_check() ) { 341 387 $rewrite_enabled = step1(); 342 388 printstep1form( $rewrite_enabled );
Note: See TracChangeset
for help on using the changeset viewer.