Heine’s picture

As with many other hooks, adding an implementation of hook_init() to an existing module might give you inconsistent behaviour due to the various caches Drupal employs. As a symptom you'll notice that your hook_init() implementation doesn't run on cached pages. Visit admin/build/modules to remedy.

The cause: A module is only loaded during bootstrap on cached pages if its "bootstrap" flag in the system table is set. This flag is set when module_rebuild_cache runs.

So, if you add a hook_init() implementation to a module Drupal already knows about, the flag is not set (and thus the hook_init() implementation not executed on cached pages) until you visit admin/build/modules.