2010-01-31 12:55:39 +01:00
< ? php
/**
2010-03-03 08:43:32 +01:00
* Network installation administration panel .
2010-01-31 12:55:39 +01:00
*
* A multi - step process allowing the user to enable a network of WordPress sites .
*
* @ since 3.0 . 0
*
* @ package WordPress
* @ subpackage Administration
*/
2011-10-06 02:21:24 +02:00
define ( 'WP_INSTALLING_NETWORK' , true );
2010-05-29 22:35:19 +02:00
2010-01-31 12:55:39 +01:00
/** WordPress Administration Bootstrap */
2020-02-06 07:33:11 +01:00
require_once __DIR__ . '/admin.php' ;
2010-01-31 12:55:39 +01:00
2017-04-07 14:53:45 +02:00
if ( ! current_user_can ( 'setup_network' ) ) {
2016-06-29 17:16:29 +02:00
wp_die ( __ ( 'Sorry, you are not allowed to manage options for this site.' ) );
2015-09-11 00:01:24 +02:00
}
2010-03-03 08:43:32 +01:00
2010-11-18 06:29:03 +01:00
if ( is_multisite () ) {
if ( ! is_network_admin () ) {
wp_redirect ( network_admin_url ( 'setup.php' ) );
exit ;
}
2010-02-23 20:58:53 +01:00
2015-09-11 00:01:24 +02:00
if ( ! defined ( 'MULTISITE' ) ) {
wp_die ( __ ( 'The Network creation panel is not for WordPress MU networks.' ) );
2014-06-10 02:44:15 +02:00
}
2010-04-02 04:04:25 +02:00
}
2010-05-08 17:25:33 +02:00
2020-02-06 07:33:11 +01:00
require_once __DIR__ . '/includes/network.php' ;
2010-06-11 18:38:11 +02:00
2015-09-11 00:01:24 +02:00
// 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 ;
2010-03-10 09:46:05 +01:00
}
2015-09-11 00:01:24 +02:00
if ( ! network_domain_check () && ( ! defined ( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) {
2015-09-18 20:18:27 +02:00
wp_die (
printf (
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 19:13:59 +02:00
/* translators: 1: WP_ALLOW_MULTISITE, 2: wp-config.php */
2015-09-18 20:18:27 +02:00
__ ( 'You must define the %1$s constant as true in your %2$s file to allow creation of a Network.' ),
'<code>WP_ALLOW_MULTISITE</code>' ,
'<code>wp-config.php</code>'
)
);
2015-09-11 00:01:24 +02:00
}
2010-03-09 20:10:07 +01:00
2010-11-18 06:24:13 +01:00
if ( is_network_admin () ) {
2021-07-22 15:53:00 +02:00
// Used in the HTML title tag.
2017-12-01 00:11:00 +01:00
$title = __ ( 'Network Setup' );
2010-11-18 06:24:13 +01:00
$parent_file = 'settings.php' ;
} else {
2021-07-22 15:53:00 +02:00
// Used in the HTML title tag.
2017-12-01 00:11:00 +01:00
$title = __ ( 'Create a Network of WordPress Sites' );
2010-11-18 06:24:13 +01:00
$parent_file = 'tools.php' ;
}
2010-01-31 12:55:39 +01:00
2017-12-01 00:11:00 +01:00
$network_help = '<p>' . __ ( 'This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.' ) . '</p>' .
'<p>' . __ ( 'Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your installation. Fill out the network details, and click Install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).' ) . '</p>' .
'<p>' . __ ( 'The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.' ) . '</p>' .
'<p>' . __ ( 'Add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).' ) . '</p>' .
'<p>' . __ ( '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.' ) . '</p>' .
'<p>' . __ ( '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.' ) . '</p>' .
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2019-07-26 00:45:57 +02:00
'<p>' . __ ( '<a href="https://wordpress.org/support/article/create-a-network/">Documentation on Creating a Network</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/support/article/tools-network-screen/">Documentation on the Network Screen</a>' ) . '</p>' ;
2011-11-29 17:58:58 +01:00
2017-12-01 00:11:00 +01:00
get_current_screen () -> add_help_tab (
array (
'id' => 'network' ,
'title' => __ ( 'Network' ),
'content' => $network_help ,
)
);
2011-11-02 06:33:53 +01:00
2011-11-02 22:32:16 +01:00
get_current_screen () -> set_help_sidebar (
2017-12-01 00:11:00 +01:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2019-07-26 00:45:57 +02:00
'<p>' . __ ( '<a href="https://wordpress.org/support/article/create-a-network/">Documentation on Creating a Network</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/support/article/tools-network-screen/">Documentation on the Network Screen</a>' ) . '</p>' .
2019-04-09 00:59:56 +02:00
'<p>' . __ ( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
2010-05-27 23:20:23 +02:00
);
2010-01-31 12:55:39 +01:00
2020-02-06 07:33:11 +01:00
require_once ABSPATH . 'wp-admin/admin-header.php' ;
2010-01-31 12:55:39 +01:00
?>
< div class = " wrap " >
2015-06-27 17:41:25 +02:00
< h1 >< ? php echo esc_html ( $title ); ?> </h1>
2010-01-31 12:55:39 +01:00
< ? php
2010-03-09 19:58:05 +01:00
if ( $_POST ) {
2010-12-01 22:32:40 +01:00
2010-03-09 19:58:05 +01:00
check_admin_referer ( 'install-network-1' );
2010-01-31 12:55:39 +01:00
2020-02-06 07:33:11 +01:00
require_once ABSPATH . 'wp-admin/includes/upgrade.php' ;
2014-07-17 11:14:16 +02:00
// Create network tables.
2010-03-09 19:58:05 +01:00
install_network ();
2012-09-27 08:07:21 +02:00
$base = parse_url ( trailingslashit ( get_option ( 'home' ) ), PHP_URL_PATH );
2017-12-01 00:11:00 +01:00
$subdomain_install = allow_subdomain_install () ? ! empty ( $_POST [ 'subdomain_install' ] ) : false ;
2010-03-11 02:51:24 +01:00
if ( ! network_domain_check () ) {
2013-03-01 18:14:09 +01:00
$result = populate_network ( 1 , get_clean_basedomain (), sanitize_email ( $_POST [ 'email' ] ), wp_unslash ( $_POST [ 'sitename' ] ), $base , $subdomain_install );
2010-03-11 02:51:24 +01:00
if ( is_wp_error ( $result ) ) {
2020-05-23 13:38:08 +02:00
if ( 1 === count ( $result -> get_error_codes () ) && 'no_wildcard_dns' === $result -> get_error_code () ) {
2010-03-11 02:51:24 +01:00
network_step2 ( $result );
2017-12-01 00:11:00 +01:00
} else {
2010-03-11 02:51:24 +01:00
network_step1 ( $result );
2017-12-01 00:11:00 +01:00
}
2010-03-11 02:51:24 +01:00
} else {
network_step2 ();
}
} else {
network_step2 ();
}
2010-03-09 23:42:36 +01:00
} elseif ( is_multisite () || network_domain_check () ) {
2010-03-09 19:58:05 +01:00
network_step2 ();
} else {
network_step1 ();
2010-01-31 12:55:39 +01:00
}
?>
</ div >
2020-02-06 07:33:11 +01:00
< ? php require_once ABSPATH . 'wp-admin/admin-footer.php' ; ?>