Permalinks: Simplify the logic for displaying "You should update your .htaccess file now" message.

See #39547, #50834.

git-svn-id: https://develop.svn.wordpress.org/trunk@48712 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-08-02 12:49:08 +00:00
parent 2c5ef0fc2f
commit b79a8c6194

View File

@ -160,27 +160,29 @@ $using_index_permalinks = $wp_rewrite->using_index_permalinks();
if ( $structure_updated ) { if ( $structure_updated ) {
$message = __( 'Permalink structure updated.' ); $message = __( 'Permalink structure updated.' );
if ( $permalink_structure && ! $using_index_permalinks ) {
if ( $iis7_permalinks ) { if ( $iis7_permalinks ) {
if ( $permalink_structure && ! $using_index_permalinks && ! $writable ) { if ( ! $writable ) {
$message = sprintf( $message = sprintf(
/* translators: %s: web.config */ /* translators: %s: web.config */
__( 'You should update your %s file now.' ), __( 'You should update your %s file now.' ),
'<code>web.config</code>' '<code>web.config</code>'
); );
} elseif ( $permalink_structure && ! $using_index_permalinks && $writable ) { } else {
$message = sprintf( $message = sprintf(
/* translators: %s: web.config */ /* translators: %s: web.config */
__( 'Permalink structure updated. Remove write access on %s file now!' ), __( 'Permalink structure updated. Remove write access on %s file now!' ),
'<code>web.config</code>' '<code>web.config</code>'
); );
} }
} elseif ( ! $is_nginx && $permalink_structure && ! $using_index_permalinks && ! $writable && $htaccess_update_required ) { } elseif ( ! $is_nginx && $htaccess_update_required && ! $writable ) {
$message = sprintf( $message = sprintf(
/* translators: %s: .htaccess */ /* translators: %s: .htaccess */
__( 'You should update your %s file now.' ), __( 'You should update your %s file now.' ),
'<code>.htaccess</code>' '<code>.htaccess</code>'
); );
} }
}
if ( ! get_settings_errors() ) { if ( ! get_settings_errors() ) {
add_settings_error( 'general', 'settings_updated', $message, 'success' ); add_settings_error( 'general', 'settings_updated', $message, 'success' );