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; } /** * Allow subdomain installation * * @since 3.0.0 * @return bool Whether subdomain installation 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; } return true; } /** * Allow subdirectory installation. * * @since 3.0.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @return bool Whether subdirectory installation is allowed */ function allow_subdirectory_install() { global $wpdb; /** * Filters whether to enable the subdirectory installation feature in Multisite. * * @since 3.0.0 * * @param bool $allow Whether to enable the subdirectory installation 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; } /** * Prints step 1 for Network installation process. * * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network * should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo. * * @since 3.0.0 * * @global bool $is_apache * * @param WP_Error $errors */ function network_step1( $errors = false ) { global $is_apache; if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { echo '
' . __( 'ERROR:' ) . ' ' . sprintf(
/* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
__( 'The constant %s cannot be defined when creating a network.' ),
'DO_NOT_UPGRADE_GLOBAL_TABLES
'
) . '
' . __( 'Warning:' ) . ' ' . sprintf( /* translators: %s: Plugins screen URL */ __( '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(
/* translators: %s: port number */
__( 'You cannot use port numbers such as %s.' ),
'' . $has_ports . '
'
) . '
' . __( 'Caution:' ) . ' ';
printf(
/* translators: 1: wp-config.php, 2: .htaccess */
__( 'We recommend you back up your existing %1$s and %2$s files.' ),
'wp-config.php
',
'.htaccess
'
);
} elseif ( file_exists( $home_path . 'web.config' ) ) {
echo '' . __( 'Caution:' ) . ' ';
printf(
/* translators: 1: wp-config.php, 2: web.config */
__( 'We recommend you back up your existing %1$s and %2$s files.' ),
'wp-config.php
',
'web.config
'
);
} else {
echo '' . __( 'Caution:' ) . ' ';
printf(
/* translators: %s: wp-config.php */
__( 'We recommend you back up your existing %s file.' ),
'wp-config.php
'
);
}
?>
above the line reading %3$s:' ),
'wp-config.php
',
'' . $location_of_wp_config . '
',
/*
* translators: This string should only be translated if wp-config-sample.php is localized.
* You can check the localized release package or
* https://i18n.svn.wordpress.org//* ' . __( 'That’s all, stop editing! Happy publishing.' ) . ' */
'
);
?>
wp-config.php'
);
} else {
printf(
/* translators: %s: wp-config.php */
__( 'These unique authentication keys are also missing from your %s file.' ),
'wp-config.php
'
);
}
?>
';
printf(
/* translators: 1: a filename like .htaccess, 2: a file path */
__( '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.' ) . '
'; } ?>';
printf(
/* translators: 1: a filename like .htaccess, 2: a file path */
__( '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.' ) . '
'; } ?>