Concerning the general consequences of a FULL Bootstrap...

bryrock - September 17, 2009 - 18:17

My essential questions is: when "drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL)" is called, does that have the effect of initiating a bootstrap from the start (first phase), or does it just allow any bootstrapping in progress to be completed in full?

Here's some background on my question: I've been testing/debugging a module that is a Drupal implementation of http:BL. What it does in essence is intercept an IP that is not already banned and check to see if it is blacklisted or not, before continuing to grant a normal, full session to the user.

Most of the functionality takes place in an implementation of hook_boot(), before the user sees any loaded Drupal pages, and includes tasks such as logging various events in the process, but the logging can't work as written because not enough of Drupal is initialized at this point in order to successfully use watchdog().

The working solution is to call for a full bootstrap, but there's been some resistance to this; the mildest resistance comes from the possibility that a full bootstrap at this point is overkill, and taxes performance. The strongest resistance comes from concerns that it may be detrimental in some way, if the effect is such that we are re-starting a bootstrap in progress.

Any bootstrap gurus out there?

I'm no guru, but that appears

ScoutBaker - September 17, 2009 - 18:28

I'm no guru, but that appears to be the last phase of the bootstrap process, not starting over.

From the API...
DRUPAL_BOOTSTRAP_FULL: Drupal is fully loaded, validate and fix input data.

---
"Nice to meet you Rose...run for your life." - The Doctor
My first public Drupal site - EyeOnThe503

Thanks. Yes, I've been all

bryrock - September 17, 2009 - 20:38

Thanks. Yes, I've been all over the API until my eyeballs were bleeding, but I was still hard pressed to come up with a definitive conclusion. In this case, I think by the time it's being called we are already near the last phase, thus the concern as to whether or not it's a restart.

This is an off the cuff

Souvent22 - September 17, 2009 - 21:20

This is an off the cuff reply, so I haven't fully looked into it....
however, i think you will have to do a full boot-strap to get watchdog functionality; since watchdog is really a hook, and needs to load the implementations of that hook. Perhaps one work around would be to log the messaging information in a seperate table; and then proccess that table periodically ( next full page load, on cron, some other time period ). Or, just do boot-strap full. Not knowing the full details of http:BL, having not worked on it, there could be other methods too. I would say, if you're contriuting the module, do it with BT_FULL, and i'm sure the community at large will def. point you in the right direction of a better/more-efficient method.
Also, moshe had a post where he implemented a light boot-0strapping method for stuff like XML_RPC calls, etc.

My 2 cents.

 
 

Drupal is a registered trademark of Dries Buytaert.