[development] Doing hook_update_N() when module is installed

Randy Fay randy at randyfay.com
Thu Nov 12 14:01:20 UTC 2009


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.

-Randy

On Thu, Nov 12, 2009 at 2:35 AM, Ken Rickard <agentrickard at gmail.com> wrote:

> To run an action the first time a module is installed, use
> hook_enable() in D5 or D6.
>
> - Ken
>
> On Thu, Nov 12, 2009 at 5:08 AM, Randy Fay <randy at randyfay.com> wrote:
> > I'm doing a module for infrastructure which is all about applying
> > configuration updates, and it does only configuration, nothing else.
> > I'd like to create hook_update_N() functions, but I'd also like all of
> them
> > to be run when the module is installed.
> > Is there any "correct" way to do this?  Many modules implement the
> > functionality in both hook_install and hook_update_N, and that's fine for
> > database-only issues, which is what these were built around (like schema
> > changes). But it doesnt' really make sense for site config changes.
> > Obviously, I can run the hook functions from hook_install(), in direct or
> > indirect ways.
> > Suggestions?
> > Thanks,
> > -Randy
> > --
> > Randy Fay
> > Drupal Development, troubleshooting, and debugging
> > randy at randyfay.com
> > +1  970.462.7450
> >
> >
>
>
>
> --
> Ken Rickard
> agentrickard at gmail.com
> http://ken.therickards.com
>



-- 
Randy Fay
Drupal Development, troubleshooting, and debugging
randy at randyfay.com
+1  970.462.7450
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20091112/5110dbfa/attachment.html 


More information about the development mailing list