We've run into a case where the client really wants Troll's features, but for performance reasons their site runs in aggressive cache mode so hook_boot is not fired. The attached patch detects whether the site is being run in aggressive caching mode, and if so runs the code that would normally run in hook_boot in hook_init instead. It's not ideal from a load perspective to have to get all the way to the "full" bootstrap phase before potentially denying a request, but the attached seemed like a simple way to keep the module functional in that configuration.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 767144.troll_.module.patch | 7.6 KB | bdurbin |
| troll.module.patch | 7.59 KB | bdurbin |
Comments
Comment #1
deekayen commentedI can't think of what the case would be, but what if instead of checking the cache state, you just set a static variable in the new function. Still call the function in both boot and init, but check against whether or not the static bool has been set instead...
Comment #2
bdurbin commentedSure thing. Re-rolled.
Comment #3
newmediaist commentedFYI - Even after installing the patch I still get the message "The following enabled modules are incompatible with aggressive mode caching and will not function properly: troll."
My thoughts are this has something to do with Troll only changing it's behaviour once aggresive cache mode is enabled - maybe not a bug?
Comment #4
bdurbin commentedYou are correct. The list of incompatible modules will include any that implement hook_boot or hook_exit. Since even with this patch Troll still implements hook_boot, even though it correctly works around aggressive caching mode, it will still show up on the list.
Comment #5
mgiffordIf this is still an issue, please re-open and upgrade version to D7. Drupal 6 is no longer being maintained.