drupal_clear_css_cache in hook_init conflicts with css aggregation
| Project: | Role Theme Switcher |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | tiutiun |
| Status: | closed |
Jump to:
When a user has css aggregation turned on, drupal_clear_css_cache() causes the aggregated css files to be deleted and rebuilt. When they are recreated, they have a new filename (an md5 hash).
With role_thehe_switcher enabled, drupal_clear_css_cache() is called for EVERY single page request, once for every role that the user is in. This means that the css files are constantly getting regenerated with new filenames. If two requests are made, one right after the other, then the second one results in a request for a missing css file, since the css file that is being refered to in the html has since been deleted and is in the process of being recreated under a different filename.
In summary: you can not call drupal_clear_css_cache() in hook_init.

#1
#2
I've checked the problem with drupal_clear_css_cache() enabled and didn't get the described result. Probably it can be noticed on the servers with higher load
I also have checked the module with drupal_clear_css_cache() disabled and it looks it works quite well without it even when user's role is changed without login/logoff.
It looks it is obsolete code now for D6
Could you please check at your side: if module works well with drupal_clear_css_cache() DISABLED - then we remove this code.
#3
Fixed in version 6.x-1.3
#4
Automatically closed -- issue fixed for 2 weeks with no activity.