Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the "GZip CSS: Do not generate .htaccess file" button is checked this error can be thrown.
filesize() [function.filesize]: stat failed for sites/default/files/css/.htaccess in /sites/all/modules/css_gzip/css_gzip.module on line 81.
Error is a logic one, tried to do too many checks in one line. This is the new code I need to test now.
if (variable_get('css_aggregator_gzip_no_htaccess', FALSE)==TRUE) {
$htaccess_contents = <<<EOT
<FilesMatch "\.(css.gz)$">
AddEncoding x-gzip .gz
ForceType text/css
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !".*Safari.*"
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)\.css $1.css.gz [L,QSA]
</IfModule>
EOT;
if (!file_exists($htaccess) || variable_get('css_aggregator_gzip_htaccess_size', NULL)!=filesize($htaccess)) {
file_save_data($htaccess_contents, $htaccess, FILE_EXISTS_REPLACE);
variable_set('css_aggregator_gzip_htaccess_size', filesize($htaccess));
}
}
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedCommitted a slightly different version
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/css_gzip/cs...
Comment #2
mikeytown2 CreditAttribution: mikeytown2 commented