Aggregation CSS loads old files I'm a little exhausted and don't know where to look anymore.

After checking "aggregate and compress CSS-Files" it seems that Drupal is loading old files.

So far I tried:


Clearing Cache (of course)
Deleting the aggregated files from "sites/default/files/css"
Reloading page to re-aggregate the css files


Unfortunately Drupal is still loading the old files.

Where is Drupal getting these old files from and how to delete or refresh them?
These aggregated CSS and JS files are generated by drupal_build_css_cache() and drupal_build_js_cache() functions when the hash of the content changes (based on the sha256).

If clearing cache didn't help, to force removal of cached files, you can remove the following variables: drupal_css_cache_files, drupal_js_cache_files.

Using drush, it's:

drush -y vdel drupal_css_cache_files &amp;&amp; drush -y vdel drupal_js_cache_files


See also: Aggregated CSS/JS file names, when regenerated?



Other thing to check is drupal_stale_file_threshold variable which may prevent removing the old files via drupal_delete_file_if_stale(), if it's set to high.

Read more at drupal_build_css_cache() API docs page:


  The cache file name is retrieved on a page load via a lookup variable that contains an associative array. The array key is the hash of the file names in $css while the value is the cache file name. The cache file is generated in two cases. First, if there is no file name value for the key, which will happen if a new file name has been added to $css or after the lookup variable is emptied to force a rebuild of the cache. Second, the cache file is generated if it is missing on disk. Old cache files are not deleted immediately when the lookup variable is emptied, but are deleted after a set period by drupal_delete_file_if_stale(). This ensures that files referenced by a cached page will still be available.