Enable-Disbale Drupal module using Drush
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.