Useful Drupal commands
- Drupal
Here are a list of commands that come in handy when developing in Drupal.
It's really common to have a workflow in Drupal that uses the commands `updb` `cr` `cim` `cr` consequently. I don't know why it took me so long to discover this command so I am posting this. This command runs all of the previous commands in a single line, it saves so much time! Drush deployshdrush deploy ## Will perform the following drush updatedb --no-cache-clear drush cache:rebuild drush config:import drush cache:rebuild drush deploy:hook
Importing a .sql file into a Drupal installation. First we'll drop the current database as we're importing a new version. Then we'll pass the .sql file into the `drush sql-cli` command. Importing Drupal dump into databasedrush sql-drop -y drush sql-cli < ~/path/to/db-file.sql
Logging into a Drupal instance when you've lost your password and don't want to go through the process of Drush command to login to /user/login areashdrush user-login # Shorthand drush uli # Login as username ryan drush uli --name=ryan # Login as user with email address [email protected] drush uli [email protected] # Login with user id 2 drush uli --uid=2