Make WordPress Core

Ticket #10365: 10365.diff

File 10365.diff, 1.5 KB (added by Denis-de-Bernardy, 15 years ago)
  • wp-admin/includes/misc.php

     
    130130        if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
    131131                if ( got_mod_rewrite() ) {
    132132                        $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
     133                        if ( apache_mod_loaded('mod_deflate') ) {
     134                                $gzip = <<<EOS
     135<IfModule mod_deflate.c>
     136# Insert filters
     137AddOutputFilterByType DEFLATE text/plain
     138AddOutputFilterByType DEFLATE text/html
     139AddOutputFilterByType DEFLATE text/xml
     140AddOutputFilterByType DEFLATE text/css
     141AddOutputFilterByType DEFLATE application/xml
     142AddOutputFilterByType DEFLATE application/xhtml+xml
     143AddOutputFilterByType DEFLATE application/rss+xml
     144AddOutputFilterByType DEFLATE application/javascript
     145AddOutputFilterByType DEFLATE application/x-javascript
     146AddOutputFilterByType DEFLATE application/x-httpd-php
     147AddOutputFilterByType DEFLATE application/x-httpd-fastphp
     148AddOutputFilterByType DEFLATE image/svg+xml
     149
     150# Drop problematic browsers
     151BrowserMatch ^Mozilla/4 gzip-only-text/html
     152BrowserMatch ^Mozilla/4\.0[678] no-gzip
     153BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
     154
     155# Make sure proxies don't deliver the wrong content
     156Header append Vary User-Agent env=!dont-vary
     157</IfModule>
     158
     159EOS;
     160                                $rules = $gzip . $rules;
     161                        }
    133162                        return insert_with_markers( $htaccess_file, 'WordPress', $rules );
    134163                }
    135164        }