Hong Kong Drupal User Group - Introduction of Drush

Post on 28-Nov-2014

136 views 0 download

description

Introduction of Drush What is Drush? Why Drush? Installation of Drush Some general use cases

transcript

Hong Kong Drupal User Group

Introduction of Drush

Francis Yan2014 Oct 11th

Francis Yan

● COO, PantaRei Design– kpyan8s@pantarei-design.com

● Drupal user, site builder– https://www.drupal.org/u/kpyan8s

● HKDUG Organizer– https://groups.drupal.org/drupalhk

PantaRei Design

● Hong Kong based Free and Open Source Software (FOSS) service provider– Content Management System (CMS) with Drupal

– Cloud hosting with Amazon Web Services (AWS)

– Team collaborate solution with Atlassian

● Business Partnership– 2012 - AWS Consulting Partner

– 2013 - Acquia Partner

– 2013 - Atlassian Experts

– 2014 - Rackspace Hosting Partner

● FOSS Contributor– 2008 - Hong Kong Drupal User Group Co-founder

– 2012 - Drupal Services Provider

Outline

● What is Drush?● Why Drush?● Installation of Drush● Some general use cases● Q & A

What is Drush?

● A command line shell and Unix scripting interface forDrupal

● Ships with lots of useful commands for interactingwith code, e.g.– modules/themes/profiles

● Drush was originally developed by Arto for Drupal4.7. Druapl 4.7 released at 2006 May 1st.

● In May 2007, it was partly rewritten and redesignedfor Drupal 5 by frando

Why Drush?

● It helps you perform various admin tasks usingjust one or two commands in the terminal

● It replace the need for many clicks and pagerefreshes in the UI.

Installation of Drush

● Composer install / update– 3 command lines only in my case

● Manually install– Guideline : https://github.com/drush-ops/drush

Some general use cases

● Flushing the cache● Install / enable / disable / update modules● Create / delete user, reset password of user● Backup and restore database

Flushing the cache

● Important for reviewing latest result in Drupal● Command:

– drush cc all

Handle modules with Drush

● Take views module as an example● Install views

– drush dl views

● Enable views– drush en views

● Disable views– drush dis views

● Update views– drush up views

Handle user with Drush

● Create user– drush user-create username

--mail="email@example.com"--password="password"

● Delete user– drush user-cancel username

● Reset password of user– drush user-password admin

--password="new_pass"

Handle database with Drush

● Backup database– drush sql-dump > ../dump.sql

– drush sql-dump --gzip > ../drum.sql.gz

● Drop database– drush sql-drop

● Restore database– `drush sql-connect` < ../dump.sql

Q&A

Reference

● https://github.com/drush-ops/drush● http://www.drush.org/● https://www.digitalocean.com/community/tutoria

ls/a-beginner-s-guide-to-drush-the-drupal-shell● Book : Drush User's Guide, Copyright © 2012

Packt Publishing, First published: April 2012

Thank You

● Please feel free to contact us:– Unit 207, 2/F IC Development Centre, No.6 Science

Park West Avenue, Hong Kong Science Park,Shatin, N.T.

– +852 3576 3812

– http://pantarei-design.com/

– sales@pantarei-design.com