Categories
Drupal Development Resources

Managing Modules with Drush

Drush is one of my favorites tools for Drupal. It’s a huge time saver being able to type in a command instead of having to manually download modules, extracting them, and enabling them through the Drupal admin interface.

Using drush requires you to have SSH access to your server. Run the following commands from anywhere inside of your Drupal installation folder.

Downloading a Module

drush dl [project_name]

Replace [project_name] with the name of the module you want to download. It’s the part of the url after the “/project/” on drupal.org. In this example, you would use “views”

Drupal Project Name

Enabling Modules

drush en [project_name]

The great thing about using Drush to enable modules is that will prompt you to enable dependencies, and if you don’t have them on your server, it will download them for you. Huge time saver.

 Disabling Modules

drush dis [project_name]

On the flip side of enabling modules, Drush will also disable all dependent modules for you. So instead of unchecking active modules and refreshing the page, then doing it several more times to make sure you got everything, Drush does it for you in one single command.

 Updating Modules

drush up

This command will update all active modules on your site to the latest release versions, then run the database updates (update.php). This can potentially break your site if you there are conflicts in your modules, so don’t use on a live site without testing on a development environment first.

This will also update core releases and reset any changes your .htaccess or robots.txt file. Be sure to make a backup or redo your changes afterwards.

Running Database Updates Only

drush updb

If you prefer to manually update your modules, you can still save some time by running “updb”, which is the same as running update.php through a browser, but saves you some clicking.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.