11

Is there a way to update disabled modules with Drush?

Currently, when I try to update a disabled module with Drush, I get this message:

Project has no enabled extensions and can't be updated

Enabling the module is not an option as this is a live site, actually many sites. They all run off of the same Drupal code base. Some modules are used by some sites but not others (possibly not on the main site).

If Drush can't handle this, what's an easy alternative for updating modules?

1
  • About "They all run off of the same Drupal code base": please confirm if that is via a multi-site construction (if not how else)? Apr 13, 2015 at 11:11

4 Answers 4

6

You can use drush for it. First, you have to get the list of all modules that you've, for it you use drush pm-list like this drush pm-list --no-core --pipe --type="module" you'll get a list of all modules (enabled, disabled and uninstalled).

After, when you get all list of your modules, you can use drush dl [modules - list] with this command drush gonna download and replace the existent module. Like he does with drush up.

The last problem is to run the update.php, unfortunately this one you've to do it for each website or you can easily code a small script that do it.

4
  • Wow. I never even thought of doing this but sounds like it would work. Any caveats I should know about?
    – nmc
    Sep 8, 2011 at 19:48
  • Btw, Drush has a command updatedb (updb) which essentially runs update.php. You can call drush @sites updb to update all subsites all at once.
    – nmc
    Sep 8, 2011 at 19:48
  • I know, when I said that you've to update.php is either by url or drush obviously :)
    – yvan
    Sep 9, 2011 at 5:09
  • 1
    This 4-year old answer now has a better response, right here in this thread: drupal.stackexchange.com/a/177851/7009
    – Screenack
    Oct 22, 2015 at 13:02
15

I use: drush pm-updatecode --check-disabled followed by: drush @sites updatedb

The --check-disabled option was added 2014-11-04

1
  • 5
    This is now the correct response — love it accordingly.
    – Screenack
    Oct 22, 2015 at 13:01
10
drush vset update_check_disabled 1 -y
6

So, I just realized that updating disabled modules is possible through Drush provided that you've set the check box for Check for updates of disabled modules and themes in the settings of your Update manager manager module (at admin/reports/updates/settings).

Then it's a matter of issuing the command drush up modulename to update the module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.