Jump to content

Combine Compress and Cache CSS BUG


Recommended Posts

Hi,

CCC is great feature but theres a bug in it.

When you modify a css file combine file gets rebuild but its name (hash) dosen't change so with default htaccess settings server sends 301 to any user that has file with that old name and in the end user gets old css rules not the new file.

 

To fix this I added file modification time for each css file to the string hashed for combined filename. Like this (Tools.php near line 1515)

 

$infos['time'] = filemtime($infos['path']);

$css_files_by_media[$media]['date'] = max(

file_exists($infos['path']) ? $infos['time'] : 0,

$css_files_by_media[$media]['date']

);

 

if (!array_key_exists($media, $compressed_css_files_infos))

$compressed_css_files_infos[$media] = array('key' => '');

$compressed_css_files_infos[$media]['key'] .= $filename.$infos['time'];

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
  • 2 years later...
×
×
  • Create New...