WordPress.org

Make WordPress Core

Ticket #19268: htaccesscheck.diff

File htaccesscheck.diff, 1.9 KB (added by ldebrouwer, 2 years ago)
  • wp-admin/options-permalink.php

     
    126126 
    127127$wp_rewrite->flush_rules(); 
    128128 
     129if (isset($_POST['submit'])) : 
    129130 
    130 if (isset($_POST['submit'])) : ?> 
     131$requpdate = true; 
     132 
     133if ( ! $iis7_permalinks ) { 
     134        $content = @file_get_contents($home_path . '.htaccess'); 
     135        if ( $content && preg_match('/# BEGIN WordPress([^#]*)# END WordPress/im', $content, $matches) ) { 
     136                if ( isset ( $matches[1] ) && ( trim( $wp_rewrite->mod_rewrite_rules() ) == trim( $matches[1] ) ) ) { 
     137                        $requpdate = false; 
     138                } else { 
     139                        $requpdate = true; 
     140                } 
     141        } 
     142} 
     143 
     144?> 
    131145<div id="message" class="updated"><p><?php 
    132146if ( ! is_multisite() ) { 
    133147        if ( $iis7_permalinks ) { 
     
    138152                else 
    139153                        _e('Permalink structure updated'); 
    140154        } else { 
    141                 if ( $permalink_structure && ! $usingpi && ! $writable ) 
    142                         _e('You should update your .htaccess now.'); 
    143                 else 
     155                if ( $permalink_structure && ! $usingpi && ! $writable ) { 
     156                        if ( $requpdate ) 
     157                                _e('You should update your .htaccess now.'); 
     158                        else 
     159                                _e('There is no need to update your .htaccess.'); 
     160                } else { 
    144161                        _e('Permalink structure updated.'); 
     162                } 
    145163        } 
    146164} else { 
    147165        _e('Permalink structure updated.'); 
     
    252270                <?php endif; ?> 
    253271        <?php endif; ?> 
    254272<?php else : 
    255         if ( $permalink_structure && ! $usingpi && ! $writable ) : ?> 
     273        if ( $permalink_structure && ! $usingpi && ! $writable && $requpdate ) : ?> 
    256274<p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p> 
    257275<form action="options-permalink.php" method="post"> 
    258276<?php wp_nonce_field('update-permalink') ?>