X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/dc1231b7312fbdca99e9e887cc2bb35a28f85cdc..refs/tags/wordpress-4.4:/wp-admin/network.php
diff --git a/wp-admin/network.php b/wp-admin/network.php
index ae351510..38f34476 100644
--- a/wp-admin/network.php
+++ b/wp-admin/network.php
@@ -15,102 +15,39 @@ define( 'WP_INSTALLING_NETWORK', true );
/** WordPress Administration Bootstrap */
require_once( dirname( __FILE__ ) . '/admin.php' );
-if ( ! is_super_admin() )
+if ( ! is_super_admin() ) {
wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
+}
if ( is_multisite() ) {
if ( ! is_network_admin() ) {
wp_redirect( network_admin_url( 'setup.php' ) );
exit;
}
- if ( ! defined( 'MULTISITE' ) )
- wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
-}
-
-// We need to create references to ms global tables to enable Network.
-foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table )
- $wpdb->$table = $prefixed_table;
-/**
- * Check for an existing network.
- *
- * @since 3.0.0
- *
- * @global wpdb $wpdb
- *
- * @return Whether a network exists.
- */
-function network_domain_check() {
- global $wpdb;
-
- $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" );
+ if ( ! defined( 'MULTISITE' ) ) {
+ wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
}
- return false;
}
-/**
- * Allow subdomain install
- *
- * @since 3.0.0
- * @return bool Whether subdomain install is allowed
- */
-function allow_subdomain_install() {
- $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
- if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) )
- return false;
+require_once( dirname( __FILE__ ) . '/includes/network.php' );
- return true;
+// We need to create references to ms global tables to enable Network.
+foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) {
+ $wpdb->$table = $prefixed_table;
}
-/**
- * Allow subdirectory install.
- *
- * @since 3.0.0
- *
- * @global wpdb $wpdb
- *
- * @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;
- if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL )
- return true;
-
- $post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" );
- if ( empty( $post ) )
- return true;
-
- return false;
-}
-/**
- * Get base domain of network.
- *
- * @since 3.0.0
- * @return string Base domain.
- */
-function get_clean_basedomain() {
- if ( $existing_domain = network_domain_check() )
- return $existing_domain;
- $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );
- if ( $slash = strpos( $domain, '/' ) )
- $domain = substr( $domain, 0, $slash );
- return $domain;
+if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) {
+ wp_die(
+ printf(
+ /* translators: 1: WP_ALLOW_MULTISITE 2: wp-config.php */
+ __( 'You must define the %1$s constant as true in your %2$s file to allow creation of a Network.' ),
+ 'WP_ALLOW_MULTISITE
',
+ 'wp-config.php
'
+ )
+ );
}
-if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) )
- wp_die( __( 'You must define the WP_ALLOW_MULTISITE
constant as true in your wp-config.php file to allow creation of a Network.' ) );
-
if ( is_network_admin() ) {
$title = __( 'Network Setup' );
$parent_file = 'settings.php';
@@ -148,419 +85,6 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
' . __('ERROR:') . ' ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '
' . __('Warning:') . ' ' . sprintf( __( 'Please deactivate your plugins before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '
' . __( 'Once the network is created, you may reactivate your plugins.' ) . '
'; - echo ''; - include( ABSPATH . 'wp-admin/admin-footer.php' ); - die(); - } - - $hostname = get_clean_basedomain(); - $has_ports = strstr( $hostname, ':' ); - if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { - echo '' . __( 'ERROR:') . ' ' . __( 'You cannot install a network of sites with your server address.' ) . '
' . sprintf( __( 'You cannot use port numbers such as %s
.' ), $has_ports ) . '
Caution: We recommend you back up your existing wp-config.php
and %s
files.' ), '.htaccess' );
- elseif ( file_exists( $home_path . 'web.config' ) )
- printf( __( 'Caution: We recommend you back up your existing wp-config.php
and %s
files.' ), 'web.config' );
- else
- _e( 'Caution: We recommend you back up your existing wp-config.php
file.' );
- ?>
wp-config.php file in %s
above the line reading /* That’s all, stop editing! Happy blogging. */
:' ), $location_of_wp_config ); ?>
- wp-config.php file.' );
- } else {
- _e( 'These unique authentication keys are also missing from your wp-config.php
file.' );
- }
- ?>
-
-
';
- /* 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 '
' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '
'; - ?> -';
- /* 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 '
' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '
'; - ?> - - - - - -