[development] Eliminate hooks entirely in Drupal 6
Rob Barreca
rob at electronicinsight.com
Tue Jan 23 23:40:22 UTC 2007
> http://cvs.drupal.org/viewcvs/drupal/contributions/modules/notify/notify.module?rev=2.54&view=markup
Heh, and I combined that .inc back into notify.module to have all the
code in one place. Shows how much I know! :-[
Rob Roy Barreca
Founder and COO
Electronic Insight Corporation
http://www.electronicinsight.com
rob at electronicinsight.com
Gerhard Killesreiter wrote:
> Gabor Hojtsy wrote:
>> On Tue, 23 Jan 2007, Earl Miles wrote:
>>> The $file would be a file that should live in the same directory as
>>> the .module file and tells the system which file to conditionally
>>> load when that callback is invoked. This is one of the things that
>>> creates a big advantage in this system: We could move callbacks into
>>> conditionally loaded files, allowing Drupal's minimum per-page
>>> codesize to be smaller. The 'nodeapi' hook is not run for every page
>>> load, but because hooks are anonymous right now, that code *must* be
>>> present.
>>
>> Well, I am increasingly adopting a similar coding practice. A few
>> days ago, I also split up archive.module into a small stub which
>> registers the menu item and has a page callback, and then that page
>> callback includes archive.inc which contains all the magic to display
>> an archive page.
>
> Can I just quickly claim prior art for this ;-?
>
> http://cvs.drupal.org/viewcvs/drupal/contributions/modules/notify/notify.module?rev=2.54&view=markup
>
>
>> This does eliminate a great deal of parsing for PHP. Although we use
>> an opcode cache here, we observed greatly reduced memory usage if we
>> take care of doing our own modules this way. (I don't have hard
>> numbers unfortunately).
>
> The problem with this approach is that it needs to be finetuned for
> every module. For most modules you can safely but admin related stuff
> into an .inc file, sometimes you can put other stuff into an .inc too.
>
> The ultimate vesion of this was Karoly's split patch, which he has
> abandoned.
>
> I think it would be intersting to learn about any advantage this idea
> has even if you use APC.
>
> Cheers,
> Gerhard
More information about the development
mailing list