Make WordPress Core


Ignore:
Timestamp:
05/04/2010 08:48:28 PM (15 years ago)
Author:
nacin
Message:

Deprecate VHOST in favor of a boolean, SUBDOMAIN_INSTALL. Core will keep VHOST defined for plugins' sake, but you should only define SUBDOMAIN_INSTALL. Throws a notice if VHOST is defined, and a warning if they somehow conflict. Sunrise can still handle them. fixes #11796.

File:
1 edited

Legend:

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

    r14386 r14452  
    4141 *
    4242 * @since 3.0.0
    43  * @return bool - whether subdomain install is allowed
     43 * @return bool Whether subdomain install is allowed
    4444 */
    4545function allow_subdomain_install() {
     
    238238
    239239    if ( $_POST ) {
    240         $vhost = !allow_subdomain_install() ? false : (bool) $_POST['subdomain_install'];
     240        $subdomain_install = allow_subdomain_install() ? ! empty( $_POST['subdomain_install'] ) : false;
    241241    } else {
    242242        if ( is_multisite() ) {
    243             $vhost = is_subdomain_install();
     243            $subdomain_install = is_subdomain_install();
    244244?>
    245245    <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>
    246246<?php   } else {
    247             $vhost = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
     247            $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
    248248?>
    249249    <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
     
    266266                <textarea class="code" readonly="readonly" cols="100" rows="7">
    267267define( 'MULTISITE', true );
    268 define( 'VHOST', '<?php echo $vhost ? 'yes' : 'no'; ?>' );
     268define( 'SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?> );
    269269$base = '<?php echo $base; ?>';
    270270define( 'DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>' );
     
    310310
    311311# uploaded files
    312 RewriteRule ^' . ( $vhost ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $vhost ? 1 : 2 ) . ' [L]' . "\n";
    313 
    314 if ( ! $vhost )
     312RewriteRule ^' . ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n";
     313
     314if ( ! $subdomain_install )
    315315    $htaccess_file .= "\n# add a trailing slash to /wp-admin\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . "\n";
    316316
     
    320320
    321321// @todo custom content dir.
    322 if ( ! $vhost )
     322if ( ! $subdomain_install )
    323323    $htaccess_file .= "\n" . 'RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    324324RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]';
     
    328328?>
    329329            <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
    330                 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $vhost ? 11 : 16; ?>">
     330                <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>">
    331331<?php echo wp_htmledit_pre( $htaccess_file ); ?>
    332332</textarea></li>
Note: See TracChangeset for help on using the changeset viewer.