[development] Doing hook_update_N() when module is installed

Moshe Weitzman weitzman at tejasa.com
Thu Nov 12 15:07:28 UTC 2009


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.


More information about the development mailing list