Drush

Drush useful commands cheatsheet


Use drush to disable all non-core modules

Use Drush to quickly disable all non-core modules:

drush pml --no-core --type=module --status=enabled --pipe | xargs drush -y dis


Moving content from Drupal7 to another Drupal7

Steps:

1. build your structure in your new D7 same as old D7

2. export your fields with bundle_copy and import them in new D7

3. export your data with data_export_import module and import them in new D7


How To Use Registry Rebuild With Drush in multisite

There are times in Drupal 7 when the registry gets hopelessly hosed and you need to rebuild the registry (a list of PHP classes and the files they go with). Sometimes, though, you can't do this regular cache-clear activity because some class is required when the system is trying to bootstrap. (such as moving modules folder to another folders / multisite things)

This is the preferred technique, and it should work with multisite installs.


Update Drupal site with Drush

Run following steps:

Checking update status:
Drush @prod pm-updatestatus

Run update:
Drush @prod pm-update

Clear all cache:
Drush @prod cc all


Install Drush on your sever with Composer (without bleeding)

Follow this steps on your ssh command line with root access.

Step1. Install Composer Globally - One Drush for all Projects


Change password from Drush

Run command in your drush

drush upwd --password="mynewpassword" admin

The last word is your username "admin".


Clear cache using Drush

To clear all cache use the following command:

  1. drush cache-clear all

result: