What is Drush?
It is a Command line interface for managing your Drupal website. It can help you install modules, download modules, uninstall modules and much more all without even opening a web browser. It also cuts down on development/upgrade time significantly.
What can Drush Do for you?
- Work with Drupal Core
- Work with Fields (D7)
- Work with Contrib modules
- Work with Database
- Work with Users
Drush Windows Installation
Drush is a great tool for quickly managing routine tasks with a Drupal installation. It allows you to search the drupal.org site, install Drupal, install modules, enable modules and much more.
It provides a convenient way to install Drush and the components it needs in order to run on Microsoft Windows.
Installation in Windows 7/8
When installing drush using the Drush 5.8 Windows Installer, this screen will appear:
There are three boxes that are marked "X" (not installed). Click on Drush Setup dropdown.
Select "Entire feature will be installed on local hard drive" option
- cwRsync Optional Componet box - this option will (with a few other tweaks) enable you to use the drush rsync command.
- Register Environment Variables - this option will update the PATH so that git bash knows where to find the drush programs.
- WinRM - For remote management of windows hosts.
We can also fix the issue after installing the drush, we need to determine the drush PATH. To fix this we need to ser the User Variables.
Go to My Computer » Properties » Advanced Systems Settings » System Properties » Advanced tab » Environmental Variables and paste the below folder paths into the Variable Value text box.
C:\ProgramData\Drush\;C:\Program Files (x86)\Drush\GnuWin32\bin;
To test Drush's functionality in Drush Command Prompt, open a new Drush Command Prompt window and enter the drush command:
You should get something like:
PHP configuration : C:\Program Files \Drush\Php\php.ini
Drush versio : 5.8
Drush configuration :
Common Drush Commands
Here are some of the popular commands.
|drush status||Shows the status of your Drupal Install|
|drush dl||Download and install a drupal module. This defaults to the sites/all/modules directory.|
|drush en||Enable a module|
|drush dis||Disable a module|
|drush up||Check for available updates, download updated modules, and run update.php|
|drush up||Check to see if the specific module needs updating, and if so, download it and run update.php|
|drush dl pathauto && drush en pathauto -y||Download Pathauto and its dependent module and enable it.|
|drush sql-dump --result-file=db-backup.sql||Dump the entire Drupal database into a file called db-backup.sql. In other words, backup your database.|
|drush sql-cli < db-backup.sql||Connect to the database server and run the commands in db-backup.sql. In other words, restore the database from db-backup.sql|
|drush cc all||Clear all caches|
|drush vset preprocess_css 0 --yes||Turn off CSS caching. This is useful when developing themes.|
|drush cron||Run cron|
|drush vset site_offline 1 --yes||Put a site into maintenance mode (D6 only)|
|drush vset maintenance_mode 1 --yes||Put a site into maintenance mode (D7 only)|
|drush vset site_offline 0 --yes||Take a site out of maintenance mode (D6 only)|
|drush vset maintenance_mode 0 --yes||Take a site out of maintenance mode (D7 only)|