Enable-Disbale Drupal module using Drush

February 14th, 2013 | Posted by Nitesh Luharuka in Drupal | Drush | PhP

Friends,

When working with Drupal, modules are like the bat and ball for programmers. In development phase, we have to disable/re-enable a module hundreds of time before the module is finalized. Drush is a very strong shell script that allows us to do several daily basis jobs in Drupal from command line. Once installed on the server, you can do several jobs within seconds. If you do not have drush installed, you can download it from here.

To disable a module, write the following command:

drush pm-disable module_name

To enable a module, write the following command:

drush pm-enable module_name

If you are running multiple sites with single codebase of Drupal and want to disable/enable the same module on all these sites, you can use the following commands -

Disable a module

drush @sites -y -r /var/www/ pm-disable mymodule

Enable a module

drush @sites -y -r /var/www/ pm-enable mymodule

In the above command,

@sites — Tells Drush to iterate through all folders present under sites folder of Drupal

-y — Auto answer “Yes” to all questions asked during the execution of the command

-r — Recursive

/var/www– Folder path where Drupal is installed.

Hope you find this post useful. If you have any questions, comment below or contact me here.

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Support us!

If you like this site please help and make click on any of these buttons!

×