tables( 'ms_global' ) as $table => $prefixed_table )
$wpdb->$table = $prefixed_table;
/**
* Check for an existing network.
*
* @since 3.0.0
* @return Whether a network exists.
*/
function network_domain_check() {
global $wpdb;
if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) )
return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" );
return false;
}
/**
* Allow subdomain install
*
* @since 3.0.0
* @return bool Whether subdomain install is allowed
*/
function allow_subdomain_install() {
$domain = preg_replace( '|https?://[^/]|', '', get_option( 'siteurl' ) );
if( false !== strpos( $domain, '/' ) || 'localhost' == $domain || preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $domain ) )
return false;
return true;
}
/**
* Allow folder install
*
* @since 3.0.0
* @return bool Whether folder install is allowed
*/
function allow_folder_install() {
global $wpdb;
if ( apply_filters( 'allow_folder_install', false ) )
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( __( 'You must define the WP_ALLOW_MULTISITE
constant as true in your wp-config.php file to allow creation of a Network.' ) );
$title = __( 'Create a Network of WordPress Sites' );
$parent_file = 'tools.php';
// @todo: Documentation?
// add_contextual_help( $current_screen, ... );
include( './admin-header.php' );
?>
' . __('Error:') . ' ' . sprintf( __( 'Your WordPress address must match your Site address before creating a Network. See General Settings.' ), esc_url( admin_url( 'options-general.php' ) ) ) . '
' . __('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( './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 backup your existing wp-config.php
and .htaccess
files.' ); ?>
blogs.dir directory in %s
. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR );
if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )
echo ' ' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '
wp-config.php file in %s
above the line reading /* That’s all, stop editing! Happy blogging. */
:' ), ABSPATH ); ?>
wp-config.php file.', 'These unique authentication keys are also missing from your wp-config.php
file.', $num_keys_salts ); ?>
web.config file in %s
, replacing other WordPress rules:' ), ABSPATH ); ?>
.htaccess file in %s
, replacing other WordPress rules:' ), ABSPATH ); ?>