2

Drupal 7 is not loading Civi 4.4's resources: CSS & jQuery. Clearing Drupal cache solves the problem, for a few hours, then it happens again. I've tried the following:

  1. custom theme? nope, it's happening in Seven or Garland
  2. resource URLs in CiviCRM are correct
  3. disabled and re-enabled Civi as a module, no permanent solution.
  4. disabled other modules like jQuery Update or Admin Menu
  5. Turning off Drupal cache, CSS and jQuery aggregation. It has no effect, even though clearing Drupal's cache solves the problem.

Note it's not a conflict between js, the Civi resources simply aren't loading.

This started happening after an upgrade from 4.2 to 4.4. Any ideas for help?

no resources missing javascript

Getting Called

5
  • It's tricky given the lack of reproducibility. Is upgrading to 4.6 not an option?
    – Coleman
    Jul 15, 2015 at 19:15
  • Intermittent perhaps isn't the best word, and the bug is reproducible. I clear Drupal cache, and Civi loads its resources and works. I log out, I wait a few hours, log back in and Civi's not working again. 4.6 is sadly not an option, they have extensions that require 4.4. Any ideas? Would uninstalling CiviCRM as a Drupal module (and removing its entry from the 'system' table) do something? Jul 15, 2015 at 20:21
  • Well it would certainly do "something" ;) As for actually solving your problem... still not sure but will let you know if I get any bright ideas.
    – Coleman
    Jul 15, 2015 at 20:37
  • Ok. ;-) Seriously though, what affect does it have to 1) first disable Civi as a module and then 2) remove the 'civicrm' entry from the 'system' table. Is it the same as clicking Uninstall from within Drupal? It doesn't affect the civicrm separate database, but might correct erroneous information Drupal is storing, wouldn't it? Jul 15, 2015 at 20:41
  • Did you ever find out why this is happening? I have the same issue with 2 setups I have. One running with Civi 4.6.8 and Drupal 7.39 and one with Civi 4.5.8 and Drupal 7.34. That whole chunk of @import stuff just isn't in page source. Turning off caching and clearing cache makes no difference. Thanks
    – Katy J
    Oct 1, 2015 at 12:27

2 Answers 2

2

Check what caching you have set up in Drupal. My suspicion is that aggressive caching somewhere is taking a snapshot of the head on a non-Civi page (since that's most of your site) and presuming that it's the universal header.

You might try disabling all caching and see whether it continues to break an hour or two after you clear your caches. Alternatively, look through any cache modules or services you've got and think whether it might cause this.

4
  • That's I'll try caching. Her's the modules list. block_query ckeditor date_repeat_presets fences menu_block nodesinblock relation views .. boxes ckeditor_swf delta getid3 menu_import omega_tools scanner views_boxes addressfield cck_blocks content_ Jul 16, 2015 at 15:28
  • access devel google_analytics metatag pathauto site_map views_slideshow admin_menu cctags context elfinder jquery_update metatags_quick print superfish wysiwyg backup_migrate civicrm ctools email libraries nodequeue README.txt taxonomy_menu block_class civicrm_cicero date entity_autocomplete link nodereference_url references token Jul 16, 2015 at 15:29
  • None of those looks like an obvious problem, but I don't know for sure. Even just turning off everything you can find on the Performance page would be worth a shot. Also, you may see caching data in the response header if you use Firebug.
    – Andie Hunt
    Jul 18, 2015 at 22:52
  • I was unable to locate why the problem kept recurring every few hours and specifically why truncating the cache_bootstrap table solved the problem reliably each time. Module incompatibility was apparently not a factor. I eventually write a script to clear drupal cache ever 30 minutes and that provided a solution to the problem, even if the cause remains unknown. webmaster.net/tutorials/drupal/… Jul 19, 2015 at 6:35
1

Civi's core resources (styles and scripts) are added at runtime so you probably won't gain anything by disabling/enabling the civicrm module in Drupal. But since you are able to reproduce the problem somewhat reliably, I'd suggest you put a debug/logging statement in a couple places in the file civicrm.module. Namely:

  • In the function civicrm_html_head() to ensure it's being called.
  • In the function civicrm_initialize() - look for the line where it says drupal_add_html_head($header);. That's the key bit so you definitely want to make sure that function is getting called.
2
  • Thanks Coleman. Here's a result of some testing. It looks like addCoreResources is getting called, it's just not showing up on the page. I think this is Drupal's problem, not Civi's. (see new screenshot at the first post) Jul 16, 2015 at 15:25
  • Hi @Coleman. Here's another interesting info. Removing this drupal db row specifically fixes the problem: cache_bootstrap.cid where cid = "module_implements". What confuses me is that the function civicrm_html_head() does appear to be getting called, even when the jQuery fails to load (see screenshot above). Thoughts? Jul 17, 2015 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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