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.

Comments

deekayen’s picture

Status: Needs review » Needs work

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

bdurbin’s picture

Status: Needs work » Needs review
StatusFileSize
new7.6 KB

Sure thing. Re-rolled.

newmediaist’s picture

FYI - 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?

bdurbin’s picture

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

mgifford’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

If this is still an issue, please re-open and upgrade version to D7. Drupal 6 is no longer being maintained.