WordPress.org

Make WordPress Core

Ticket #22639: 22639.3.diff

File 22639.3.diff, 3.6 KB (added by nacin, 5 years ago)

Less ambitious attempt. Unfortunately, this means we're only using get_home_path() for the displayed text, and not for the areas that count - calculating the base for rewrites.

  • wp-admin/network.php

     
    316316        $wp_siteurl_subdir = trailingslashit( '/' . preg_replace( '#^' . preg_quote( $base, '#' ) . '#', '', $wp_dir_from_root ) );
    317317        $rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';
    318318
     319        $home_path         = get_home_path();
     320
     321        $location_of_wp_config = ABSPATH;
     322        if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) )
     323                $location_of_wp_config = trailingslashit( dirname( ABSPATH ) );
     324
    319325        // Wildcard DNS message.
    320326        if ( is_wp_error( $errors ) )
    321327                echo '<div class="error">' . $errors->get_error_message() . '</div>';
     
    349355                <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
    350356                <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
    351357                <div class="updated inline"><p><?php
    352                         if ( file_exists( ABSPATH . '.htaccess' ) )
     358                        if ( file_exists( $home_path . '.htaccess' ) )
    353359                                printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), '.htaccess' );
    354                         elseif ( file_exists( ABSPATH . 'web.config' ) )
     360                        elseif ( file_exists( $home_path . 'web.config' ) )
    355361                                printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), 'web.config' );
    356362                        else
    357363                                _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );
     
    360366        }
    361367?>
    362368                <ol>
    363                         <li><p><?php printf( __( 'Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:' ), ABSPATH ); ?></p>
     369                        <li><p><?php printf( __( 'Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:' ), $location_of_wp_config ); ?></p>
    364370                                <textarea class="code" readonly="readonly" cols="100" rows="6">
    365371define('MULTISITE', true);
    366372define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>);
     
    454460EOF;
    455461
    456462        ?>
    457                 <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), trailingslashit( str_replace( trailingslashit( $wp_siteurl_subdir ), '', ABSPATH ) ) ); ?></p>
     463                <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), $home_path ); ?></p>
    458464                <?php
    459465                if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
    460466                        echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
     
    488494EOF;
    489495
    490496                ?>
    491                 <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
     497                <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), $home_path ); ?></p>
    492498                <?php
    493499                if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
    494500                        echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';