Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By softrusher on
In bootstrab.inc it says:
// Call all init() and exit() hooks without including all modules.
// Only use those hooks for critical operations.
foreach (bootstrap_hooks() as $hook) {
module_invoke_all($hook);
}
then in module.inc
function module_invoke($module, $hook, $a1 = NULL, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
$function = $module .'_'. $hook;
if (function_exists($function)) {
return $function($a1, $a2, $a3, $a4);
}
}
The function_exists() is done on the whole list of active modules! (So all of these have to be loaded even with pages from cache!)
And in fact only 3 of my ~35-40 modules have an _init or _exit hook.
So would'n it be better to save a bool in the database for every modul having an _init or _exit?, and only loading these modules along with cached pages? You can get a hook list on module activation and save the value to the DB at this time.
hope it helps. -alex
Comments
hmm.. found something ;-)
First read all the code.. then post ;-)
so ignore this whole post!