Changeset 48710 for trunk/src/wp-admin/options-permalink.php
- Timestamp:
- 08/02/2020 12:34:05 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/options-permalink.php
r48694 r48710 73 73 } 74 74 75 /* 75 /** 76 76 * In a subdirectory configuration of multisite, the `/blog` prefix is used by 77 77 * default on the main site to avoid collisions with other sites created on that … … 83 83 } 84 84 85 $category_base = get_option( 'category_base' ); 86 $tag_base = get_option( 'tag_base' ); 87 $update_required = false; 88 89 if ( $iis7_permalinks ) { 90 if ( ( ! file_exists( $home_path . 'web.config' ) && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) ) { 91 $writable = true; 92 } else { 93 $writable = false; 94 } 95 } elseif ( $is_nginx ) { 96 $writable = false; 97 } else { 98 if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) { 99 $writable = true; 100 } else { 101 $writable = false; 102 $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) ); 103 $new_rules = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) ); 104 $update_required = ( $new_rules !== $existing_rules ); 105 } 106 } 107 108 $using_index_permalinks = $wp_rewrite->using_index_permalinks(); 85 $category_base = get_option( 'category_base' ); 86 $tag_base = get_option( 'tag_base' ); 87 88 $structure_updated = false; 89 $htaccess_update_required = false; 109 90 110 91 if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) ) { … … 112 93 113 94 if ( isset( $_POST['permalink_structure'] ) ) { 114 if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) {95 if ( isset( $_POST['selection'] ) && 'custom' !== $_POST['selection'] ) { 115 96 $permalink_structure = $_POST['selection']; 116 97 } else { … … 130 111 131 112 $wp_rewrite->set_permalink_structure( $permalink_structure ); 113 114 $structure_updated = true; 132 115 } 133 116 134 117 if ( isset( $_POST['category_base'] ) ) { 135 118 $category_base = $_POST['category_base']; 119 136 120 if ( ! empty( $category_base ) ) { 137 121 $category_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); 138 122 } 123 139 124 $wp_rewrite->set_category_base( $category_base ); 140 125 } … … 142 127 if ( isset( $_POST['tag_base'] ) ) { 143 128 $tag_base = $_POST['tag_base']; 129 144 130 if ( ! empty( $tag_base ) ) { 145 131 $tag_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); 146 132 } 133 147 134 $wp_rewrite->set_tag_base( $tag_base ); 148 135 } 149 136 } 137 138 if ( $iis7_permalinks ) { 139 if ( ( ! file_exists( $home_path . 'web.config' ) && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) ) { 140 $writable = true; 141 } else { 142 $writable = false; 143 } 144 } elseif ( $is_nginx ) { 145 $writable = false; 146 } else { 147 if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) { 148 $writable = true; 149 } else { 150 $writable = false; 151 $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) ); 152 $new_rules = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) ); 153 154 $htaccess_update_required = ( $new_rules !== $existing_rules ); 155 } 156 } 157 158 $using_index_permalinks = $wp_rewrite->using_index_permalinks(); 159 160 if ( $structure_updated ) { 150 161 $message = __( 'Permalink structure updated.' ); 151 162 … … 164 175 ); 165 176 } 166 } elseif ( ! $is_nginx && $permalink_structure && ! $using_index_permalinks && ! $writable && $ update_required ) {177 } elseif ( ! $is_nginx && $permalink_structure && ! $using_index_permalinks && ! $writable && $htaccess_update_required ) { 167 178 $message = sprintf( 168 179 /* translators: %s: .htaccess */ … … 401 412 <?php 402 413 else : 403 if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $ update_required ) :414 if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $htaccess_update_required ) : 404 415 ?> 405 416 <p>
Note: See TracChangeset
for help on using the changeset viewer.