Make WordPress Core

Changeset 13622


Ignore:
Timestamp:
03/09/2010 06:14:42 AM (17 years ago)
Author:
nacin
Message:

Allow localhost in a multisite subdirectory install. More network.php improvements. see #12457 for localhost. see #11816

Location:
trunk
Files:
4 edited

Legend:

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

    r13614 r13622  
    5757
    5858        $hostname = get_clean_basedomain();
    59         if ( 'localhost' == $hostname || preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $hostname ) ) {
     59        if ( preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $hostname ) ) {
    6060                echo '<p><strong>' . __('You cannot install a network of sites with your server address.' ) . '</strong></p>';
    61                 echo '<p>' . __('You cannot use an IP address such as <code>127.0.0.1</code> or a single-word hostname like <code>localhost</code>.' ) . '</p>';
    62                 if ( 'localhost' == $hostname )
    63                         echo '<p>' . __('Consider using <code>localhost.localdomain</code>.') . '</p>';
     61                echo '<p>' . __('You cannot use an IP address such as <code>127.0.0.1</code>.' ) . '</p>';
    6462                include( './admin-footer.php' );
    6563                die();
    … …  
    9492<?php   } ?>
    9593                <input type='hidden' name='action' value='step2' />
     94<?php   if ( 'localhost' != $hostname ) : ?>
    9695                <h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3>
    97        
    9896                <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>
    9997                <p><?php _e( "You will need a wildcard DNS record if you're going to use the virtual host (sub-domain) functionality." ); ?></p>
    … …  
    114112
    115113                <?php
     114                endif;
     115
    116116                $is_www = ( substr( $hostname, 0, 4 ) == 'www.' );
    117117                if ( $is_www ) :
    … …  
    132132                <h3><?php esc_html_e( 'Network Details' ); ?></h3>
    133133                <table class="form-table">
     134                <?php if ( 'localhost' == $hostname ) : ?>
     135                        <tr>
     136                                <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th>
     137                                <td><?php _e('Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.'); ?></td>
     138                        </tr>
     139                <?php endif; ?>
    134140                <?php if ( ! $is_www ) : ?>
    135141                        <tr>
    … …  
    175181                                <textarea class="code" readonly="readonly" cols="100" rows="7">
    176182define( 'MULTISITE', true );
    177 define( 'VHOST', '<?php echo 'yes' == stripslashes( $_POST['vhost'] ) ? 'yes' : 'no'; ?>' );
     183define( 'VHOST', '<?php echo ( ! empty( $_POST['vhost'] ) && 'yes' == stripslashes( $_POST['vhost'] ) ) ? 'yes' : 'no'; ?>' );
    178184$base = '<?php echo $base; ?>';
    179185define( 'DOMAIN_CURRENT_SITE', '<?php echo get_clean_basedomain(); ?>' );
    … …  
    258264                // create network tables
    259265                install_network();
     266                $hostname = get_clean_basedomain();
     267                $vhost = 'localhost' == $hostname ? false : (bool) $_POST['vhost'];
    260268                if ( !network_domain_check() || isset( $_POST['existing_network'] ) && $_POST['existing_network'] == '0' )
    261                         populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $_POST['vhost'] );
     269                        populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $vhost );
    262270                // create wp-config.php / htaccess
    263271                network_step2();
  • trunk/wp-includes/ms-default-constants.php

    r13268 r13622  
    6262         * @since 2.0.0
    6363         */
    64         if ( !defined('COOKIE_DOMAIN') ) {
     64        if ( !defined('COOKIE_DOMAIN') && 'localhost' != $current_site->cookie_domain ) {
    6565                if ( isset( $current_site->cookie_domain ) )
    6666                        define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);
  • trunk/wp-includes/ms-load.php

    r13611 r13622  
    183183 * Used when blog does not exist. Checks for a missing $wpdb->site table as well.
    184184 *
     185 * @todo update for 3.0, pare down, and i18n
     186 *
    185187 * @access private
    186188 * @since 3.0.0
    … …  
    189191        global $wpdb, $domain, $path;
    190192
    191         $msg = '<h1>' . esc_html( 'Fatal Error' ) . '</h1>';
    192         $msg  = '<p>' . 'If your site does not display, please contact the owner of this network.' . '</p>';
     193        $msg = '<h1>' . 'Fatal Error' . '</h1>';
     194        $msg .= '<p>' . 'If your site does not display, please contact the owner of this network.' . '</p>';
    193195        $msg .= '<p>' . 'If you are the owner of this network please check that MySQL is running properly and all tables are error free.' . '</p>';
    194196        if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) )
    … …  
    196198        else
    197199                $msg .= '<p>' . sprintf( '<strong>Could Not Find Site!</strong> Searched for table <em>%1$s</em> in <code>%2$s</code>. Is that right?', $domain . $path, DB_NAME, $wpdb->blogs ) . '</p>';
    198         $msg .= '<h1>' . esc_html( 'What do I do now?' ) . '</h1>';
     200        $msg .= '<h1>' . 'What do I do now?' . '</h1>';
    199201        // @todo Update WPMU codex link.
    200202        $msg .= '<p>' . 'Read the <a target="_blank" href="http://codex.wordpress.org/Debugging_WPMU">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.' . '</p>';
    … …  
    205207        $msg .= '</ul>';
    206208        // @todo Update WPMU codex link and support instructions.
    207         $msg = '<p>' . 'If you suspect a problem please report it to the support forums but you must include the information asked for in the <a target="_blank" href="http://codex.wordpress.org/Debugging_WPMU">WPMU bug reporting guidelines</a>! ' . '</p>';
    208 
    209         // @todo This file no longer exists post-merge.
    210         if ( is_file( 'release-info.txt' ) ) {
    211                 $msg .= '<p>' . 'Your bug report must include the following text:' . '</p>';
    212                 $info = file( 'release-info.txt' );
    213                 $msg .= $info[ 4 ] . '"';
    214         }
     209        $msg .= '<p>' . 'If you suspect a problem please report it to the support forums but you must include the information asked for in the <a target="_blank" href="http://codex.wordpress.org/Debugging_WPMU">WPMU bug reporting guidelines</a>! ' . '</p>';
    215210
    216211        die( $msg );
  • trunk/wp-includes/ms-settings.php

    r13610 r13622  
    1212// $base sanity check.
    1313if ( 'BASE' == $base )
    14         die( 'Configuration error in <code>wp-config.php<code>. <code>$base</code> is set to "BASE" when it should be the path like "/" or "/blogs/".' );
     14        die( 'Configuration error in <code>wp-config.php</code>. <code>$base</code> is set to "BASE" when it should be the path like "/" or "/blogs/".' );
    1515
    1616/** Include Multisite initialization functions */
Note: See TracChangeset for help on using the changeset viewer.