2

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?

  • Have you cleared your browser cache? – J. Reynolds Nov 3 '14 at 16:47
  • Japp, that as well. @J.Reynolds – Yves Nov 3 '14 at 16:49
  • Are you positive you've cleared Page cache? And caches on any reverse proxy that might be interfering? – Clive Nov 3 '14 at 16:50
  • I cleared the whole cache several times so far and the files are still app. 1-2 weeks old and about the proxy I don't think so because we don't have a proxy installed. @Clive – Yves Nov 3 '14 at 17:23
  • Wait. We're using a cdn module to load the assets from sub-domains. I don't know exactly but isn't a cdn using a reverse proxy to route the queries? If so where is the cache? @Clive – Yves Nov 3 '14 at 17:31
1

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 && 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.

1

Try flushing the cache, saving your theme settings, and flush them again.

Some themes, such as Adaptive Themes, still keeps some files that aren't flushed until the themes settings are saved.

I discovered it here.

You could also try AdvAggr. Thank you @mikeytown2!

  • 1
    AdvAgg handles this use case out of the box; it calls at_core_settings_submit for you. – mikeytown2 May 9 '17 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.