[development] Doing hook_update_N() when module is installed

Earnie Boyd earnie at users.sourceforge.net
Fri Nov 13 18:00:06 UTC 2009

On Thu, 12 Nov 2009 Randy Fay wrote:

> I keep learning every day - and I'm glad to know about hook_enable(), which
> I didn't know about.
> I don't think it answers my question, though, since I'm concerned about
> taking actions at install time, which would be hook_install(). And in my
> particular case, the install actions are the same as the set of
> hook_update_N(). The only way I know to include all those in hook_install()
> is either to duplicate code or to make a runner function. Both ugly.

Why would hook_update_N be the same as hook_install?  The hook_install  
is for installing the database as described in the hook_schema.  The  
hook_update_N is reserved for schema changes.  The hook_enable can be  
used to execute your ``runner function'' as long as the ``runner  
function'' isn't modifying the database schema.  You need to be more  
specific with what you're doing in hook_install and hook_update_N.   
You may also be interested in hook_requirements.

-- http://r-feed.com/           -- http://for-my-kids.com/
-- http://www.4offer.biz/       -- http://give-me-an-offer.com/

More information about the development mailing list