Posted by hefox on September 16, 2010 at 5:05am
in mymodule.drush.inc
<?php
/**
* Implementation of drush_hook_pre_updatedb().
*/
function drush_mymodule_pre_updatedb() {
drush_bootstrap_max();
if (!module_exists('mymodule')) {
module_enable(array('mymodule'));
}
}
?>
Comments
The takeaway is that Drush
The takeaway is that Drush calls the drush_hook_pre_updatedb() (and possibly other Drush hooks?) of disabled modules, which these modules can take advantage of to enable themselves.
I chatted with hefox about this on IRC. I personally am leaning toward this being a bug (or "unintended feature") in Drush, but hefox thinks it makes sense in terms of creating Drush-only modules…
The Boise Drupal Guy!
This recently changed in
This recently changed in Drush HEAD. If your command does a BOOTSTRAP_FULL, only enabled modules can participate in drush_invoke() hooks like pre_updatedb. If the command bootstraps to a couple levels lower, drush commandfiles are indeed eligible to hook in. See http://drupal.org/node/861822#comment-3319040 and later comments.
In Drush 3, you are correct that commandfiles in disabled modules are in play for hooks for all drush commands.