Edit File by line
/home/barbar84/www/wp-admin/includes
File: network.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WordPress Network Administration API.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
* @since 4.4.0
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Check for an existing network.
[10] Fix | Delete
*
[11] Fix | Delete
* @since 3.0.0
[12] Fix | Delete
*
[13] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[14] Fix | Delete
*
[15] Fix | Delete
* @return string|false Base domain if network exists, otherwise false.
[16] Fix | Delete
*/
[17] Fix | Delete
function network_domain_check() {
[18] Fix | Delete
global $wpdb;
[19] Fix | Delete
[20] Fix | Delete
$sql = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) );
[21] Fix | Delete
if ( $wpdb->get_var( $sql ) ) {
[22] Fix | Delete
return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" );
[23] Fix | Delete
}
[24] Fix | Delete
return false;
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Allow subdomain installation
[29] Fix | Delete
*
[30] Fix | Delete
* @since 3.0.0
[31] Fix | Delete
* @return bool Whether subdomain installation is allowed
[32] Fix | Delete
*/
[33] Fix | Delete
function allow_subdomain_install() {
[34] Fix | Delete
$domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
[35] Fix | Delete
if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
[36] Fix | Delete
return false;
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
return true;
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Allow subdirectory installation.
[44] Fix | Delete
*
[45] Fix | Delete
* @since 3.0.0
[46] Fix | Delete
*
[47] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[48] Fix | Delete
*
[49] Fix | Delete
* @return bool Whether subdirectory installation is allowed
[50] Fix | Delete
*/
[51] Fix | Delete
function allow_subdirectory_install() {
[52] Fix | Delete
global $wpdb;
[53] Fix | Delete
[54] Fix | Delete
/**
[55] Fix | Delete
* Filters whether to enable the subdirectory installation feature in Multisite.
[56] Fix | Delete
*
[57] Fix | Delete
* @since 3.0.0
[58] Fix | Delete
*
[59] Fix | Delete
* @param bool $allow Whether to enable the subdirectory installation feature in Multisite.
[60] Fix | Delete
* Default false.
[61] Fix | Delete
*/
[62] Fix | Delete
if ( apply_filters( 'allow_subdirectory_install', false ) ) {
[63] Fix | Delete
return true;
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) {
[67] Fix | Delete
return true;
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
$post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" );
[71] Fix | Delete
if ( empty( $post ) ) {
[72] Fix | Delete
return true;
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
return false;
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
/**
[79] Fix | Delete
* Get base domain of network.
[80] Fix | Delete
*
[81] Fix | Delete
* @since 3.0.0
[82] Fix | Delete
* @return string Base domain.
[83] Fix | Delete
*/
[84] Fix | Delete
function get_clean_basedomain() {
[85] Fix | Delete
$existing_domain = network_domain_check();
[86] Fix | Delete
if ( $existing_domain ) {
[87] Fix | Delete
return $existing_domain;
[88] Fix | Delete
}
[89] Fix | Delete
$domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );
[90] Fix | Delete
$slash = strpos( $domain, '/' );
[91] Fix | Delete
if ( $slash ) {
[92] Fix | Delete
$domain = substr( $domain, 0, $slash );
[93] Fix | Delete
}
[94] Fix | Delete
return $domain;
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
/**
[98] Fix | Delete
* Prints step 1 for Network installation process.
[99] Fix | Delete
*
[100] Fix | Delete
* @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such.
[101] Fix | Delete
* Navigating to Tools > Network should not be a sudden "Welcome to a new install process!
[102] Fix | Delete
* Fill this out and click here." See also contextual help todo.
[103] Fix | Delete
*
[104] Fix | Delete
* @since 3.0.0
[105] Fix | Delete
*
[106] Fix | Delete
* @global bool $is_apache
[107] Fix | Delete
*
[108] Fix | Delete
* @param false|WP_Error $errors Optional. Error object. Default false.
[109] Fix | Delete
*/
[110] Fix | Delete
function network_step1( $errors = false ) {
[111] Fix | Delete
global $is_apache;
[112] Fix | Delete
[113] Fix | Delete
if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
[114] Fix | Delete
echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . sprintf(
[115] Fix | Delete
/* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
[116] Fix | Delete
__( 'The constant %s cannot be defined when creating a network.' ),
[117] Fix | Delete
'<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>'
[118] Fix | Delete
) . '</p></div>';
[119] Fix | Delete
echo '</div>';
[120] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-footer.php';
[121] Fix | Delete
die();
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
$active_plugins = get_option( 'active_plugins' );
[125] Fix | Delete
if ( ! empty( $active_plugins ) ) {
[126] Fix | Delete
echo '<div class="notice notice-warning"><p><strong>' . __( 'Warning:' ) . '</strong> ' . sprintf(
[127] Fix | Delete
/* translators: %s: URL to Plugins screen. */
[128] Fix | Delete
__( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ),
[129] Fix | Delete
admin_url( 'plugins.php?plugin_status=active' )
[130] Fix | Delete
) . '</p></div>';
[131] Fix | Delete
echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';
[132] Fix | Delete
echo '</div>';
[133] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-footer.php';
[134] Fix | Delete
die();
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
$hostname = get_clean_basedomain();
[138] Fix | Delete
$has_ports = strstr( $hostname, ':' );
[139] Fix | Delete
if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) {
[140] Fix | Delete
echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
[141] Fix | Delete
echo '<p>' . sprintf(
[142] Fix | Delete
/* translators: %s: Port number. */
[143] Fix | Delete
__( 'You cannot use port numbers such as %s.' ),
[144] Fix | Delete
'<code>' . $has_ports . '</code>'
[145] Fix | Delete
) . '</p>';
[146] Fix | Delete
echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Go to Dashboard' ) . '</a>';
[147] Fix | Delete
echo '</div>';
[148] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-footer.php';
[149] Fix | Delete
die();
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
echo '<form method="post">';
[153] Fix | Delete
[154] Fix | Delete
wp_nonce_field( 'install-network-1' );
[155] Fix | Delete
[156] Fix | Delete
$error_codes = array();
[157] Fix | Delete
if ( is_wp_error( $errors ) ) {
[158] Fix | Delete
echo '<div class="error"><p><strong>' . __( 'Error: The network could not be created.' ) . '</strong></p>';
[159] Fix | Delete
foreach ( $errors->get_error_messages() as $error ) {
[160] Fix | Delete
echo "<p>$error</p>";
[161] Fix | Delete
}
[162] Fix | Delete
echo '</div>';
[163] Fix | Delete
$error_codes = $errors->get_error_codes();
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) {
[167] Fix | Delete
$site_name = $_POST['sitename'];
[168] Fix | Delete
} else {
[169] Fix | Delete
/* translators: %s: Default network title. */
[170] Fix | Delete
$site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) );
[171] Fix | Delete
}
[172] Fix | Delete
[173] Fix | Delete
if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes, true ) ) {
[174] Fix | Delete
$admin_email = $_POST['email'];
[175] Fix | Delete
} else {
[176] Fix | Delete
$admin_email = get_option( 'admin_email' );
[177] Fix | Delete
}
[178] Fix | Delete
?>
[179] Fix | Delete
<p><?php _e( 'Welcome to the Network installation process!' ); ?></p>
[180] Fix | Delete
<p><?php _e( 'Fill in the information below and you&#8217;ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.' ); ?></p>
[181] Fix | Delete
<?php
[182] Fix | Delete
[183] Fix | Delete
if ( isset( $_POST['subdomain_install'] ) ) {
[184] Fix | Delete
$subdomain_install = (bool) $_POST['subdomain_install'];
[185] Fix | Delete
} elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // Assume nothing.
[186] Fix | Delete
$subdomain_install = true;
[187] Fix | Delete
} elseif ( ! allow_subdirectory_install() ) {
[188] Fix | Delete
$subdomain_install = true;
[189] Fix | Delete
} else {
[190] Fix | Delete
$subdomain_install = false;
[191] Fix | Delete
$got_mod_rewrite = got_mod_rewrite();
[192] Fix | Delete
if ( $got_mod_rewrite ) { // Dangerous assumptions.
[193] Fix | Delete
echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ';
[194] Fix | Delete
printf(
[195] Fix | Delete
/* translators: %s: mod_rewrite */
[196] Fix | Delete
__( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ),
[197] Fix | Delete
'<code>mod_rewrite</code>'
[198] Fix | Delete
);
[199] Fix | Delete
echo '</p>';
[200] Fix | Delete
} elseif ( $is_apache ) {
[201] Fix | Delete
echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ';
[202] Fix | Delete
printf(
[203] Fix | Delete
/* translators: %s: mod_rewrite */
[204] Fix | Delete
__( 'It looks like the Apache %s module is not installed.' ),
[205] Fix | Delete
'<code>mod_rewrite</code>'
[206] Fix | Delete
);
[207] Fix | Delete
echo '</p>';
[208] Fix | Delete
}
[209] Fix | Delete
[210] Fix | Delete
if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache).
[211] Fix | Delete
echo '<p>';
[212] Fix | Delete
printf(
[213] Fix | Delete
/* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite. */
[214] Fix | Delete
__( 'If %1$s is disabled, ask your administrator to enable that module, or look at the <a href="%2$s">Apache documentation</a> or <a href="%3$s">elsewhere</a> for help setting it up.' ),
[215] Fix | Delete
'<code>mod_rewrite</code>',
[216] Fix | Delete
'https://httpd.apache.org/docs/mod/mod_rewrite.html',
[217] Fix | Delete
'https://www.google.com/search?q=apache+mod_rewrite'
[218] Fix | Delete
);
[219] Fix | Delete
echo '</p></div>';
[220] Fix | Delete
}
[221] Fix | Delete
}
[222] Fix | Delete
[223] Fix | Delete
if ( allow_subdomain_install() && allow_subdirectory_install() ) :
[224] Fix | Delete
?>
[225] Fix | Delete
<h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3>
[226] Fix | Delete
<p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories.' ); ?>
[227] Fix | Delete
<strong><?php _e( 'You cannot change this later.' ); ?></strong></p>
[228] Fix | Delete
<p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p>
[229] Fix | Delete
<?php // @todo Link to an MS readme? ?>
[230] Fix | Delete
<table class="form-table" role="presentation">
[231] Fix | Delete
<tr>
[232] Fix | Delete
<th><label><input type="radio" name="subdomain_install" value="1"<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>
[233] Fix | Delete
<td>
[234] Fix | Delete
<?php
[235] Fix | Delete
printf(
[236] Fix | Delete
/* translators: 1: Host name. */
[237] Fix | Delete
_x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ),
[238] Fix | Delete
$hostname
[239] Fix | Delete
);
[240] Fix | Delete
?>
[241] Fix | Delete
</td>
[242] Fix | Delete
</tr>
[243] Fix | Delete
<tr>
[244] Fix | Delete
<th><label><input type="radio" name="subdomain_install" value="0"<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th>
[245] Fix | Delete
<td>
[246] Fix | Delete
<?php
[247] Fix | Delete
printf(
[248] Fix | Delete
/* translators: 1: Host name. */
[249] Fix | Delete
_x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ),
[250] Fix | Delete
$hostname
[251] Fix | Delete
);
[252] Fix | Delete
?>
[253] Fix | Delete
</td>
[254] Fix | Delete
</tr>
[255] Fix | Delete
</table>
[256] Fix | Delete
[257] Fix | Delete
<?php
[258] Fix | Delete
endif;
[259] Fix | Delete
[260] Fix | Delete
if ( WP_CONTENT_DIR !== ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) {
[261] Fix | Delete
echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
[262] Fix | Delete
}
[263] Fix | Delete
[264] Fix | Delete
$is_www = ( 0 === strpos( $hostname, 'www.' ) );
[265] Fix | Delete
if ( $is_www ) :
[266] Fix | Delete
?>
[267] Fix | Delete
<h3><?php esc_html_e( 'Server Address' ); ?></h3>
[268] Fix | Delete
<p>
[269] Fix | Delete
<?php
[270] Fix | Delete
printf(
[271] Fix | Delete
/* translators: 1: Site URL, 2: Host name, 3: www. */
[272] Fix | Delete
__( 'We recommend you change your site domain to %1$s before enabling the network feature. It will still be possible to visit your site using the %3$s prefix with an address like %2$s but any links will not have the %3$s prefix.' ),
[273] Fix | Delete
'<code>' . substr( $hostname, 4 ) . '</code>',
[274] Fix | Delete
'<code>' . $hostname . '</code>',
[275] Fix | Delete
'<code>www</code>'
[276] Fix | Delete
);
[277] Fix | Delete
?>
[278] Fix | Delete
</p>
[279] Fix | Delete
<table class="form-table" role="presentation">
[280] Fix | Delete
<tr>
[281] Fix | Delete
<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
[282] Fix | Delete
<td>
[283] Fix | Delete
<?php
[284] Fix | Delete
printf(
[285] Fix | Delete
/* translators: %s: Host name. */
[286] Fix | Delete
__( 'The internet address of your network will be %s.' ),
[287] Fix | Delete
'<code>' . $hostname . '</code>'
[288] Fix | Delete
);
[289] Fix | Delete
?>
[290] Fix | Delete
</td>
[291] Fix | Delete
</tr>
[292] Fix | Delete
</table>
[293] Fix | Delete
<?php endif; ?>
[294] Fix | Delete
[295] Fix | Delete
<h3><?php esc_html_e( 'Network Details' ); ?></h3>
[296] Fix | Delete
<table class="form-table" role="presentation">
[297] Fix | Delete
<?php if ( 'localhost' === $hostname ) : ?>
[298] Fix | Delete
<tr>
[299] Fix | Delete
<th scope="row"><?php esc_html_e( 'Sub-directory Installation' ); ?></th>
[300] Fix | Delete
<td>
[301] Fix | Delete
<?php
[302] Fix | Delete
printf(
[303] Fix | Delete
/* translators: 1: localhost, 2: localhost.localdomain */
[304] Fix | Delete
__( 'Because you are using %1$s, the sites in your WordPress network must use sub-directories. Consider using %2$s if you wish to use sub-domains.' ),
[305] Fix | Delete
'<code>localhost</code>',
[306] Fix | Delete
'<code>localhost.localdomain</code>'
[307] Fix | Delete
);
[308] Fix | Delete
// Uh oh:
[309] Fix | Delete
if ( ! allow_subdirectory_install() ) {
[310] Fix | Delete
echo ' <strong>' . __( 'Warning:' ) . ' ' . __( 'The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
[311] Fix | Delete
}
[312] Fix | Delete
?>
[313] Fix | Delete
</td>
[314] Fix | Delete
</tr>
[315] Fix | Delete
<?php elseif ( ! allow_subdomain_install() ) : ?>
[316] Fix | Delete
<tr>
[317] Fix | Delete
<th scope="row"><?php esc_html_e( 'Sub-directory Installation' ); ?></th>
[318] Fix | Delete
<td>
[319] Fix | Delete
<?php
[320] Fix | Delete
_e( 'Because your installation is in a directory, the sites in your WordPress network must use sub-directories.' );
[321] Fix | Delete
// Uh oh:
[322] Fix | Delete
if ( ! allow_subdirectory_install() ) {
[323] Fix | Delete
echo ' <strong>' . __( 'Warning:' ) . ' ' . __( 'The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
[324] Fix | Delete
}
[325] Fix | Delete
?>
[326] Fix | Delete
</td>
[327] Fix | Delete
</tr>
[328] Fix | Delete
<?php elseif ( ! allow_subdirectory_install() ) : ?>
[329] Fix | Delete
<tr>
[330] Fix | Delete
<th scope="row"><?php esc_html_e( 'Sub-domain Installation' ); ?></th>
[331] Fix | Delete
<td>
[332] Fix | Delete
<?php
[333] Fix | Delete
_e( 'Because your installation is not new, the sites in your WordPress network must use sub-domains.' );
[334] Fix | Delete
echo ' <strong>' . __( 'The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
[335] Fix | Delete
?>
[336] Fix | Delete
</td>
[337] Fix | Delete
</tr>
[338] Fix | Delete
<?php endif; ?>
[339] Fix | Delete
<?php if ( ! $is_www ) : ?>
[340] Fix | Delete
<tr>
[341] Fix | Delete
<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
[342] Fix | Delete
<td>
[343] Fix | Delete
<?php
[344] Fix | Delete
printf(
[345] Fix | Delete
/* translators: %s: Host name. */
[346] Fix | Delete
__( 'The internet address of your network will be %s.' ),
[347] Fix | Delete
'<code>' . $hostname . '</code>'
[348] Fix | Delete
);
[349] Fix | Delete
?>
[350] Fix | Delete
</td>
[351] Fix | Delete
</tr>
[352] Fix | Delete
<?php endif; ?>
[353] Fix | Delete
<tr>
[354] Fix | Delete
<th scope='row'><label for="sitename"><?php esc_html_e( 'Network Title' ); ?></label></th>
[355] Fix | Delete
<td>
[356] Fix | Delete
<input name='sitename' id='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' />
[357] Fix | Delete
<p class="description">
[358] Fix | Delete
<?php _e( 'What would you like to call your network?' ); ?>
[359] Fix | Delete
</p>
[360] Fix | Delete
</td>
[361] Fix | Delete
</tr>
[362] Fix | Delete
<tr>
[363] Fix | Delete
<th scope='row'><label for="email"><?php esc_html_e( 'Network Admin Email' ); ?></label></th>
[364] Fix | Delete
<td>
[365] Fix | Delete
<input name='email' id='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' />
[366] Fix | Delete
<p class="description">
[367] Fix | Delete
<?php _e( 'Your email address.' ); ?>
[368] Fix | Delete
</p>
[369] Fix | Delete
</td>
[370] Fix | Delete
</tr>
[371] Fix | Delete
</table>
[372] Fix | Delete
<?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?>
[373] Fix | Delete
</form>
[374] Fix | Delete
<?php
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
/**
[378] Fix | Delete
* Prints step 2 for Network installation process.
[379] Fix | Delete
*
[380] Fix | Delete
* @since 3.0.0
[381] Fix | Delete
*
[382] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[383] Fix | Delete
* @global bool $is_nginx Whether the server software is Nginx or something else.
[384] Fix | Delete
*
[385] Fix | Delete
* @param false|WP_Error $errors Optional. Error object. Default false.
[386] Fix | Delete
*/
[387] Fix | Delete
function network_step2( $errors = false ) {
[388] Fix | Delete
global $wpdb, $is_nginx;
[389] Fix | Delete
[390] Fix | Delete
$hostname = get_clean_basedomain();
[391] Fix | Delete
$slashed_home = trailingslashit( get_option( 'home' ) );
[392] Fix | Delete
$base = parse_url( $slashed_home, PHP_URL_PATH );
[393] Fix | Delete
$document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
[394] Fix | Delete
$abspath_fix = str_replace( '\\', '/', ABSPATH );
[395] Fix | Delete
$home_path = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
[396] Fix | Delete
$wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
[397] Fix | Delete
$rewrite_base = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';
[398] Fix | Delete
[399] Fix | Delete
$location_of_wp_config = $abspath_fix;
[400] Fix | Delete
if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) {
[401] Fix | Delete
$location_of_wp_config = dirname( $abspath_fix );
[402] Fix | Delete
}
[403] Fix | Delete
$location_of_wp_config = trailingslashit( $location_of_wp_config );
[404] Fix | Delete
[405] Fix | Delete
// Wildcard DNS message.
[406] Fix | Delete
if ( is_wp_error( $errors ) ) {
[407] Fix | Delete
echo '<div class="error">' . $errors->get_error_message() . '</div>';
[408] Fix | Delete
}
[409] Fix | Delete
[410] Fix | Delete
if ( $_POST ) {
[411] Fix | Delete
if ( allow_subdomain_install() ) {
[412] Fix | Delete
$subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
[413] Fix | Delete
} else {
[414] Fix | Delete
$subdomain_install = false;
[415] Fix | Delete
}
[416] Fix | Delete
} else {
[417] Fix | Delete
if ( is_multisite() ) {
[418] Fix | Delete
$subdomain_install = is_subdomain_install();
[419] Fix | Delete
?>
[420] Fix | Delete
<p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p>
[421] Fix | Delete
<?php
[422] Fix | Delete
} else {
[423] Fix | Delete
$subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
[424] Fix | Delete
?>
[425] Fix | Delete
<div class="error"><p><strong><?php _e( 'Warning:' ); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
[426] Fix | Delete
<p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p>
[427] Fix | Delete
<?php
[428] Fix | Delete
}
[429] Fix | Delete
}
[430] Fix | Delete
[431] Fix | Delete
$subdir_match = $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?';
[432] Fix | Delete
$subdir_replacement_01 = $subdomain_install ? '' : '$1';
[433] Fix | Delete
$subdir_replacement_12 = $subdomain_install ? '$1' : '$2';
[434] Fix | Delete
[435] Fix | Delete
if ( $_POST || ! is_multisite() ) {
[436] Fix | Delete
?>
[437] Fix | Delete
<h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
[438] Fix | Delete
<p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
[439] Fix | Delete
<div class="notice notice-warning inline"><p>
[440] Fix | Delete
<?php
[441] Fix | Delete
if ( file_exists( $home_path . '.htaccess' ) ) {
[442] Fix | Delete
echo '<strong>' . __( 'Caution:' ) . '</strong> ';
[443] Fix | Delete
printf(
[444] Fix | Delete
/* translators: 1: wp-config.php, 2: .htaccess */
[445] Fix | Delete
__( 'We recommend you back up your existing %1$s and %2$s files.' ),
[446] Fix | Delete
'<code>wp-config.php</code>',
[447] Fix | Delete
'<code>.htaccess</code>'
[448] Fix | Delete
);
[449] Fix | Delete
} elseif ( file_exists( $home_path . 'web.config' ) ) {
[450] Fix | Delete
echo '<strong>' . __( 'Caution:' ) . '</strong> ';
[451] Fix | Delete
printf(
[452] Fix | Delete
/* translators: 1: wp-config.php, 2: web.config */
[453] Fix | Delete
__( 'We recommend you back up your existing %1$s and %2$s files.' ),
[454] Fix | Delete
'<code>wp-config.php</code>',
[455] Fix | Delete
'<code>web.config</code>'
[456] Fix | Delete
);
[457] Fix | Delete
} else {
[458] Fix | Delete
echo '<strong>' . __( 'Caution:' ) . '</strong> ';
[459] Fix | Delete
printf(
[460] Fix | Delete
/* translators: %s: wp-config.php */
[461] Fix | Delete
__( 'We recommend you back up your existing %s file.' ),
[462] Fix | Delete
'<code>wp-config.php</code>'
[463] Fix | Delete
);
[464] Fix | Delete
}
[465] Fix | Delete
?>
[466] Fix | Delete
</p></div>
[467] Fix | Delete
<?php
[468] Fix | Delete
}
[469] Fix | Delete
?>
[470] Fix | Delete
<ol>
[471] Fix | Delete
<li><p>
[472] Fix | Delete
<?php
[473] Fix | Delete
printf(
[474] Fix | Delete
/* translators: 1: wp-config.php, 2: Location of wp-config file, 3: Translated version of "That's all, stop editing! Happy publishing." */
[475] Fix | Delete
__( 'Add the following to your %1$s file in %2$s <strong>above</strong> the line reading %3$s:' ),
[476] Fix | Delete
'<code>wp-config.php</code>',
[477] Fix | Delete
'<code>' . $location_of_wp_config . '</code>',
[478] Fix | Delete
/*
[479] Fix | Delete
* translators: This string should only be translated if wp-config-sample.php is localized.
[480] Fix | Delete
* You can check the localized release package or
[481] Fix | Delete
* https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php
[482] Fix | Delete
*/
[483] Fix | Delete
'<code>/* ' . __( 'That&#8217;s all, stop editing! Happy publishing.' ) . ' */</code>'
[484] Fix | Delete
);
[485] Fix | Delete
?>
[486] Fix | Delete
</p>
[487] Fix | Delete
<textarea class="code" readonly="readonly" cols="100" rows="7">
[488] Fix | Delete
define('MULTISITE', true);
[489] Fix | Delete
define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>);
[490] Fix | Delete
define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>');
[491] Fix | Delete
define('PATH_CURRENT_SITE', '<?php echo $base; ?>');
[492] Fix | Delete
define('SITE_ID_CURRENT_SITE', 1);
[493] Fix | Delete
define('BLOG_ID_CURRENT_SITE', 1);
[494] Fix | Delete
</textarea>
[495] Fix | Delete
<?php
[496] Fix | Delete
$keys_salts = array(
[497] Fix | Delete
'AUTH_KEY' => '',
[498] Fix | Delete
'SECURE_AUTH_KEY' => '',
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function