[development] Fatal error : install profiles and the use of hook_install

Augustin (Beginner) drupal.beginner at wechange.org
Fri Nov 30 07:12:19 UTC 2007


Hello,


There seem to be a critical bugs hiding behind the way the install 
profiles are implemented.
At the very least, there seem to be a gross inconsistency in the 
documentation.
I could have fixed the api documentation myself, except that I am not 
sure what is the 'normal' behavior.


When creating an install profile, one runs against such errors:
"Fatal error: Call to undefined function xxx()"
http://www.google.com/search?q=site%3Adrupal.org+profile+install+Fatal+error%3A+Call+to+undefined+function

This happens when one includes a few specific modules in 
hook_profile_modules(), including book.module:
http://drupal.org/node/164458#comment-643884

The api says that all functions are loaded when running 
hook_install():

http://api.drupal.org/api/function/hook_install
"Note that since this function is called from a full bootstrap, all 
functions (including those in modules enabled by the current page 
request) are available when this hook is called. Use cases could be 
displaying a user message, or calling a module function necessary for 
initial setup, etc."

But the profile documentation implies the contrary:
http://drupal.org/node/67921
the modules (including core required modules and their functions) are 
NOT yet included when running hook_profile_modules() (which calls 
hook_install()). The modules are included only at a later stage, 
hook_profile_final().

A similar problem occurred with forum.module, until a certain function 
call was moved to hook_enable():
http://drupal.org/node/157519


This begs the question: what is it ok to include in hook_install()? 
Is hook_install() only for the DB schema, or can heavier lifting be 
done using any function call?


If this cannot be fixed for D6, some warning should be included in the 
documentation, especially here: http://drupal.org/node/67921 .
I didn't do so myself because I am uncertain about all the above.




Blessings,

Augustin.





More information about the development mailing list