Permalinks: After [37747], make sure `$usingpi`, `$writable`, and `$update_required` are defined before checking them on permalinks update.

Props Clorith.
Fixes #37380.

git-svn-id: https://develop.svn.wordpress.org/trunk@38066 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2016-07-16 12:43:16 +00:00
parent 9d0f2e27d0
commit d5ba63e6a5
1 changed files with 24 additions and 24 deletions

View File

@ -66,6 +66,30 @@ if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpo
$blog_prefix = '/blog';
}
$category_base = get_option( 'category_base' );
$tag_base = get_option( 'tag_base' );
$update_required = false;
if ( $iis7_permalinks ) {
if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') )
$writable = true;
else
$writable = false;
} elseif ( $is_nginx ) {
$writable = false;
} else {
if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
$writable = true;
} else {
$writable = false;
$existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
$new_rules = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );
$update_required = ( $new_rules !== $existing_rules );
}
}
$usingpi = $wp_rewrite->using_index_permalinks();
if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
check_admin_referer('update-permalink');
@ -124,30 +148,6 @@ if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
exit;
}
$category_base = get_option( 'category_base' );
$tag_base = get_option( 'tag_base' );
$update_required = false;
if ( $iis7_permalinks ) {
if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') )
$writable = true;
else
$writable = false;
} elseif ( $is_nginx ) {
$writable = false;
} else {
if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
$writable = true;
} else {
$writable = false;
$existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
$new_rules = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );
$update_required = ( $new_rules !== $existing_rules );
}
}
$usingpi = $wp_rewrite->using_index_permalinks();
flush_rewrite_rules();
require( ABSPATH . 'wp-admin/admin-header.php' );