wp/wp-admin/network.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 19 3d72ae0968f4
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    11  */
    11  */
    12 
    12 
    13 define( 'WP_INSTALLING_NETWORK', true );
    13 define( 'WP_INSTALLING_NETWORK', true );
    14 
    14 
    15 /** WordPress Administration Bootstrap */
    15 /** WordPress Administration Bootstrap */
    16 require_once( dirname( __FILE__ ) . '/admin.php' );
    16 require_once __DIR__ . '/admin.php';
    17 
    17 
    18 if ( ! current_user_can( 'setup_network' ) ) {
    18 if ( ! current_user_can( 'setup_network' ) ) {
    19 	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
    19 	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
    20 }
    20 }
    21 
    21 
    28 	if ( ! defined( 'MULTISITE' ) ) {
    28 	if ( ! defined( 'MULTISITE' ) ) {
    29 		wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
    29 		wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
    30 	}
    30 	}
    31 }
    31 }
    32 
    32 
    33 require_once( dirname( __FILE__ ) . '/includes/network.php' );
    33 require_once __DIR__ . '/includes/network.php';
    34 
    34 
    35 // We need to create references to ms global tables to enable Network.
    35 // We need to create references to ms global tables to enable Network.
    36 foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) {
    36 foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) {
    37 	$wpdb->$table = $prefixed_table;
    37 	$wpdb->$table = $prefixed_table;
    38 }
    38 }
    39 
    39 
    40 if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) {
    40 if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) {
    41 	wp_die(
    41 	wp_die(
    42 		printf(
    42 		printf(
    43 			/* translators: 1: WP_ALLOW_MULTISITE 2: wp-config.php */
    43 			/* translators: 1: WP_ALLOW_MULTISITE, 2: wp-config.php */
    44 			__( 'You must define the %1$s constant as true in your %2$s file to allow creation of a Network.' ),
    44 			__( 'You must define the %1$s constant as true in your %2$s file to allow creation of a Network.' ),
    45 			'<code>WP_ALLOW_MULTISITE</code>',
    45 			'<code>WP_ALLOW_MULTISITE</code>',
    46 			'<code>wp-config.php</code>'
    46 			'<code>wp-config.php</code>'
    47 		)
    47 		)
    48 	);
    48 	);
    61 	'<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>' .
    61 	'<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>' .
    62 	'<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>' .
    62 	'<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>' .
    63 	'<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>' .
    63 	'<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>' .
    64 	'<p>' . __( 'The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed in a future version.' ) . '</p>' .
    64 	'<p>' . __( 'The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed in a future version.' ) . '</p>' .
    65 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    65 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    66 	'<p>' . __( '<a href="https://codex.wordpress.org/Create_A_Network">Documentation on Creating a Network</a>' ) . '</p>' .
    66 	'<p>' . __( '<a href="https://wordpress.org/support/article/create-a-network/">Documentation on Creating a Network</a>' ) . '</p>' .
    67 	'<p>' . __( '<a href="https://codex.wordpress.org/Tools_Network_Screen">Documentation on the Network Screen</a>' ) . '</p>';
    67 	'<p>' . __( '<a href="https://wordpress.org/support/article/tools-network-screen/">Documentation on the Network Screen</a>' ) . '</p>';
    68 
    68 
    69 get_current_screen()->add_help_tab(
    69 get_current_screen()->add_help_tab(
    70 	array(
    70 	array(
    71 		'id'      => 'network',
    71 		'id'      => 'network',
    72 		'title'   => __( 'Network' ),
    72 		'title'   => __( 'Network' ),
    74 	)
    74 	)
    75 );
    75 );
    76 
    76 
    77 get_current_screen()->set_help_sidebar(
    77 get_current_screen()->set_help_sidebar(
    78 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    78 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    79 	'<p>' . __( '<a href="https://codex.wordpress.org/Create_A_Network">Documentation on Creating a Network</a>' ) . '</p>' .
    79 	'<p>' . __( '<a href="https://wordpress.org/support/article/create-a-network/">Documentation on Creating a Network</a>' ) . '</p>' .
    80 	'<p>' . __( '<a href="https://codex.wordpress.org/Tools_Network_Screen">Documentation on the Network Screen</a>' ) . '</p>' .
    80 	'<p>' . __( '<a href="https://wordpress.org/support/article/tools-network-screen/">Documentation on the Network Screen</a>' ) . '</p>' .
    81 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    81 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    82 );
    82 );
    83 
    83 
    84 include( ABSPATH . 'wp-admin/admin-header.php' );
    84 require_once ABSPATH . 'wp-admin/admin-header.php';
    85 ?>
    85 ?>
    86 <div class="wrap">
    86 <div class="wrap">
    87 <h1><?php echo esc_html( $title ); ?></h1>
    87 <h1><?php echo esc_html( $title ); ?></h1>
    88 
    88 
    89 <?php
    89 <?php
    90 if ( $_POST ) {
    90 if ( $_POST ) {
    91 
    91 
    92 	check_admin_referer( 'install-network-1' );
    92 	check_admin_referer( 'install-network-1' );
    93 
    93 
    94 	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    94 	require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    95 	// Create network tables.
    95 	// Create network tables.
    96 	install_network();
    96 	install_network();
    97 	$base              = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
    97 	$base              = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
    98 	$subdomain_install = allow_subdomain_install() ? ! empty( $_POST['subdomain_install'] ) : false;
    98 	$subdomain_install = allow_subdomain_install() ? ! empty( $_POST['subdomain_install'] ) : false;
    99 	if ( ! network_domain_check() ) {
    99 	if ( ! network_domain_check() ) {
   100 		$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );
   100 		$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );
   101 		if ( is_wp_error( $result ) ) {
   101 		if ( is_wp_error( $result ) ) {
   102 			if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) {
   102 			if ( 1 === count( $result->get_error_codes() ) && 'no_wildcard_dns' === $result->get_error_code() ) {
   103 				network_step2( $result );
   103 				network_step2( $result );
   104 			} else {
   104 			} else {
   105 				network_step1( $result );
   105 				network_step1( $result );
   106 			}
   106 			}
   107 		} else {
   107 		} else {
   116 	network_step1();
   116 	network_step1();
   117 }
   117 }
   118 ?>
   118 ?>
   119 </div>
   119 </div>
   120 
   120 
   121 <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
   121 <?php require_once ABSPATH . 'wp-admin/admin-footer.php'; ?>