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

mikeytown2’s picture

mikeytown2’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.