X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/61343b82c4f0da4c68e4c6373daafff4a81efdd1..ac7339a398e6df50f722bc9616291ce5447d8e5e:/wp-admin/network.php diff --git a/wp-admin/network.php b/wp-admin/network.php index c3dea684..fdc0a51b 100644 --- a/wp-admin/network.php +++ b/wp-admin/network.php @@ -13,7 +13,7 @@ define( 'WP_INSTALLING_NETWORK', true ); /** WordPress Administration Bootstrap */ -require_once( './admin.php' ); +require_once( dirname( __FILE__ ) . '/admin.php' ); if ( ! is_super_admin() ) wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); @@ -39,8 +39,11 @@ foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) */ function network_domain_check() { global $wpdb; - if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) ) + + $sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) ); + if ( $wpdb->get_var( $sql ) ) { return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" ); + } return false; } @@ -58,13 +61,20 @@ function allow_subdomain_install() { return true; } /** - * Allow subdirectory install + * Allow subdirectory install. * * @since 3.0.0 * @return bool Whether subdirectory install is allowed */ function allow_subdirectory_install() { global $wpdb; + /** + * Filter whether to enable the subdirectory install feature in Multisite. + * + * @since 3.0.0 + * + * @param bool true Whether to enable the subdirectory install feature in Multisite. Default is false. + */ if ( apply_filters( 'allow_subdirectory_install', false ) ) return true; @@ -110,8 +120,8 @@ $network_help = '

' . __('This screen allows you to configure a network as hav '

' . __('Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.') . '

' . '

' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with “/blog/” from the main site. This disabling will be addressed in a future version.') . '

' . '

' . __('For more information:') . '

' . - '

' . __('Documentation on Creating a Network') . '

' . - '

' . __('Documentation on the Network Screen') . '

'; + '

' . __('Documentation on Creating a Network') . '

' . + '

' . __('Documentation on the Network Screen') . '

'; get_current_screen()->add_help_tab( array( 'id' => 'network', @@ -121,15 +131,14 @@ get_current_screen()->add_help_tab( array( get_current_screen()->set_help_sidebar( '

' . __('For more information:') . '

' . - '

' . __('Documentation on Creating a Network') . '

' . - '

' . __('Documentation on the Network Screen') . '

' . - '

' . __('Support Forums') . '

' + '

' . __('Documentation on Creating a Network') . '

' . + '

' . __('Documentation on the Network Screen') . '

' . + '

' . __('Support Forums') . '

' ); include( ABSPATH . 'wp-admin/admin-header.php' ); ?>
-

' . __('ERROR:') . ' ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '

'; echo ''; - include ( ABSPATH . 'wp-admin/admin-footer.php' ); + include( ABSPATH . 'wp-admin/admin-footer.php' ); die(); } @@ -170,7 +179,7 @@ function network_step1( $errors = false ) { die(); } - echo '
'; + echo ''; wp_nonce_field( 'install-network-1' ); @@ -213,12 +222,20 @@ function network_step1( $errors = false ) { - - + + - - + +
site1.%1$s and site2.%1$s', 'subdomain examples' ), $hostname ); ?>site1.%1$s and site2.%1$s', 'subdomain examples' ), + $hostname + ); ?>
%1$s/site1 and %1$s/site2', 'subdirectory examples' ), $hostname ); ?>%1$s/site1 and %1$s/site2', 'subdirectory examples' ), + $hostname + ); ?>
@@ -285,14 +302,18 @@ function network_step1( $errors = false ) { -
+

+ +

- + -
+

+ +

@@ -319,9 +340,11 @@ function network_step2( $errors = false ) { $rewrite_base = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : ''; - $location_of_wp_config = ABSPATH; - if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) - $location_of_wp_config = trailingslashit( dirname( ABSPATH ) ); + $location_of_wp_config = $abspath_fix; + if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) { + $location_of_wp_config = dirname( $abspath_fix ); + } + $location_of_wp_config = trailingslashit( $location_of_wp_config ); // Wildcard DNS message. if ( is_wp_error( $errors ) ) @@ -368,13 +391,14 @@ function network_step2( $errors = false ) { ?>
  1. wp-config.php file in %s above the line reading /* That’s all, stop editing! Happy blogging. */:' ), $location_of_wp_config ); ?>

    - +define('BLOG_ID_CURRENT_SITE', 1); + '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' ); foreach ( $keys_salts as $c => $v ) { @@ -397,8 +421,16 @@ define('BLOG_ID_CURRENT_SITE', 1); } $num_keys_salts = count( $keys_salts ); ?> -

    wp-config.php file.', 'These unique authentication keys are also missing from your wp-config.php file.', $num_keys_salts ); ?>

    +

    + wp-config.php file.' ); + } else { + _e( 'These unique authentication keys are also missing from your wp-config.php file.' ); + } + ?> + +

    $web_config_file .= ' - + '; } $web_config_file .= ' @@ -455,11 +487,14 @@ define('BLOG_ID_CURRENT_SITE', 1); -'; - - ?> -
  2. web.config file in %s, replacing other WordPress rules:' ), $home_path ); ?>

    - +'; + + echo '
  3. '; + /* translators: 1: a filename like .htaccess. 2: a file path. */ + printf( __( 'Add the following to your %1$s file in %2$s, replacing other WordPress rules:' ), + 'web.config', '' . $home_path . '' ); + echo '

    '; if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) echo '

    ' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '

    '; ?> @@ -472,7 +507,7 @@ define('BLOG_ID_CURRENT_SITE', 1); $ms_files_rewriting = ''; if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^"; - $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}wp-includes/ms-files.php?file={$subdir_replacement_12} [L]" . "\n"; + $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n"; } $htaccess_file = << -
  4. .htaccess file in %s, replacing other WordPress rules:' ), $home_path ); ?>

    -

    '; + /* translators: 1: a filename like .htaccess. 2: a file path. */ + printf( __( 'Add the following to your %1$s file in %2$s, replacing other WordPress rules:' ), + '.htaccess', '' . $home_path . '' ); + echo '

    '; if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) echo '

    ' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '

    '; ?> @@ -504,7 +542,7 @@ EOF; -

    +