[development] Doing hook_update_N() when module is installed

Ken Rickard agentrickard at gmail.com
Fri Nov 13 00:08:37 UTC 2009


Yes, Moshe is right. hook_install() is better, though I prefer the
hook_enable / hook_disable combo to running specific "must have"
routines in hook_update_N.

- Ken

On Thu, Nov 12, 2009 at 4:07 PM, Moshe Weitzman <weitzman at tejasa.com> wrote:
> We've run in this pattern a lot with economist.com. We avoided code
> duplication for a while and just ran all our updates in
> hook_install(). That became awful after a while since were doing and
> undoing things that had changed over time during hook_install. Now, we
> set ourselves up to the latest, good configuration in hook_install().
> In a few cases, that does mean calling into an update function
> directly but most of the time we just set the variables and such in
> both the install and update hooks. Thats the drupal way, right now.
>
> Also, I think Ken meant hook_install, not hook_enable when he offerred
> a place to do one-time install related activity. hook_enable is
> potentially run many times.
>



-- 
Ken Rickard
agentrickard at gmail.com
http://ken.therickards.com


More information about the development mailing list