[development] Doing hook_update_N() when module is installed
Pierre Rineau
pierre.rineau at makina-corpus.com
Thu Nov 12 14:09:25 UTC 2009
On Thu, 2009-11-12 at 08:55 -0500, Nancy Wichmann wrote:
> My suggestion would rather be to just call the appropriate hook_update_N()
> within the hook_install(). It may look a bit of a kludge, but it is the
> safer thing to do.
I often does some thing like:
function _mymodule_some_new_really_important_business_stuff() {
// Bla bla
}
function mymodule_install() {
// Some stuff
_mymodule_some_business_stuff();
// Some other stuff
}
function mymodule_update_N() {
// Some stuff again
_mymodule_some_business_stuff();
// Some other stuff again
}
To remove some ambiguity. It does nothing more than calling the
mymodule_update_N() function into the hook_install(), but it allows you
to put other things that don't have to be called at install in the same
hook_update_N() implementation.
Pierre.
More information about the development
mailing list