Thanks for your comments on this! <br><br>While you're right that the original intent of hook_install() is to do a <i>schema</i> setup and the original intent of hook_update_N() it to update that when change occur down the line, they are both actually and widely used to set up the Drupal configuration in non-schema ways so that it's ready for the module. You yourself mentioned in a later message a variable_set() which is a configuration change, not a schema change. <br>
<br>I *think* that the reality is that these two functions are often used in a variety of ways to make sure configuration is correct for the current version of the module, not just in terms of schema.<br><br>You mention the idea of setting up something for cron to do... but that would be a privately implemented hook_update_N, woudn't it? <br>
<br>In my case, which is a bit extreme, I'm writing a module whose only job is to do one-off configuration changes to staging*.<a href="http://drupal.org">drupal.org</a>. There are 10 of these machines, and their configuration is slightly different from Drupal.org, but they are occasionally reinstalled with D.o's database. That means that the install needs to work to set the config correctly, and also that when a config change is introduced, hook_update_N (or a similar technique) needs to take care of it. We're trying to avoid reconfiguring everywhere.<br>
<br>As others have mentioned, this pattern is quite common.<br><br>A valuable discussion. I'm interested in hearing more.<br><br>-Randy<br><br><br><br><div class="gmail_quote">On Fri, Nov 13, 2009 at 11:00 AM, Earnie Boyd <span dir="ltr"><<a href="mailto:earnie@users.sourceforge.net">earnie@users.sourceforge.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Thu, 12 Nov 2009 Randy Fay wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I keep learning every day - and I'm glad to know about hook_enable(), which<br>
I didn't know about.<br>
<br>
I don't think it answers my question, though, since I'm concerned about<br>
taking actions at install time, which would be hook_install(). And in my<br>
particular case, the install actions are the same as the set of<br>
hook_update_N(). The only way I know to include all those in hook_install()<br>
is either to duplicate code or to make a runner function. Both ugly.<br>
<br>
</blockquote>
<br></div>
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.<br>
<font color="#888888">
<br>
--<br>
Earnie<br>
-- <a href="http://r-feed.com/" target="_blank">http://r-feed.com/</a> -- <a href="http://for-my-kids.com/" target="_blank">http://for-my-kids.com/</a><br>
-- <a href="http://www.4offer.biz/" target="_blank">http://www.4offer.biz/</a> -- <a href="http://give-me-an-offer.com/" target="_blank">http://give-me-an-offer.com/</a><br>
<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Randy Fay<br>Drupal Development, troubleshooting, and debugging<br><a href="mailto:randy@randyfay.com">randy@randyfay.com</a><br>+1 970.462.7450<br><br>