Next Tutorial

Drupal 7 Tutorial Part 15: Drupal 7 Advanced Taxonomy Concepts

Difference between hook_boot and hook_init

Submitted by anilsagar on Wed, 11/02/2011 - 23:30

Hi Drupalers,

There are some differences between hook_boot and hook_init although they seems equal. Let's check it out.

hook_boot hook_init
  • Even cached page executes this hook
  • Cached page doesn't run this hook.
  • This hook is called before modules or most include files are loaded into memory.
  • When this hook is called, all modules are already loaded in memory.
  • It happens while Drupal is still in bootstrap mode.
  • It happens after bootstrap mode.

 

Cheers,

Anil Sagar

1 comment

Well done, I found this

Submitted by Kiril (not verified) on Fri, 11/25/2011 - 08:06.

Well done, I found this summary very useful. Saves time going through the code with a debugger to differentiate what is meant by: " This hook is run at the beginning of the page request.."(Drupal.org docs).

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.
©2010 AnilSagar. All rights reserved. Drupal theme by Kiwi Themes.