Hong Kong Drupal User Group - Introduction of Drush

19
Hong Kong Drupal User Group Introduction of Drush Francis Yan 2014 Oct 11th

description

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

Transcript of Hong Kong Drupal User Group - Introduction of Drush

Page 1: Hong Kong Drupal User Group - Introduction of Drush

Hong Kong Drupal User Group

Introduction of Drush

Francis Yan2014 Oct 11th

Page 2: Hong Kong Drupal User Group - Introduction of Drush

Francis Yan

● COO, PantaRei Design– [email protected]

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

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

Page 3: Hong Kong Drupal User Group - Introduction of Drush

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

Page 4: Hong Kong Drupal User Group - Introduction of Drush
Page 5: Hong Kong Drupal User Group - Introduction of Drush
Page 6: Hong Kong Drupal User Group - Introduction of Drush
Page 7: Hong Kong Drupal User Group - Introduction of Drush

Outline

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

Page 8: Hong Kong Drupal User Group - Introduction of Drush

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

Page 9: Hong Kong Drupal User Group - Introduction of Drush
Page 10: Hong Kong Drupal User Group - Introduction of Drush

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.

Page 11: Hong Kong Drupal User Group - Introduction of Drush

Installation of Drush

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

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

Page 12: Hong Kong Drupal User Group - Introduction of Drush

Some general use cases

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

Page 13: Hong Kong Drupal User Group - Introduction of Drush

Flushing the cache

● Important for reviewing latest result in Drupal● Command:

– drush cc all

Page 14: Hong Kong Drupal User Group - Introduction of Drush

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

Page 15: Hong Kong Drupal User Group - Introduction of Drush

Handle user with Drush

● Create user– drush user-create username

--mail="[email protected]"--password="password"

● Delete user– drush user-cancel username

● Reset password of user– drush user-password admin

--password="new_pass"

Page 16: Hong Kong Drupal User Group - Introduction of Drush

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

Page 17: Hong Kong Drupal User Group - Introduction of Drush

Q&A

Page 18: Hong Kong Drupal User Group - Introduction of Drush

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

Page 19: Hong Kong Drupal User Group - Introduction of Drush

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/

[email protected]