Pierre Rineau wrote: > On Sun, 2011-02-27 at 11:31 -0800, nan wich wrote: > >> Ah, see now you say that 10% of hook_init's are appropriate, so >> telling someone to always avoid it is bad advice. In all the coding >> that I have done, I have used hook_init() maybe three times (twice I >> know for sure). And one was largely a toss up between hook_init() and >> hook_boot() and I can guarantee was needed. And you probably add >> hook_exit() to the list of questionable usage. > > Don't make me say something I didn't mean. What I really meant is that > hook_init() should never be used, some modules legally uses it as a way > to set up some context related information because no other helpers > exists in core (that's actually part of the butler project on g.d.o). > But aside of that, all hook_init() implementations should be banned. In > fact even existing one (I'm thinking about D6 OG module) can show > themselves being incredibly slow under certain circumstances. >
I'm going to agree with Nan Wich and say that your explicit "never use" statement is overboard. If used properly hook_init is a must. However, I do understand that there is improper use of the hook and grabbing a bunch of data from the DB should never be one. -- Earnie -- http://progw.com -- http://www.for-my-kids.com
