Drush:	  The	  essential	  Drupal	  toolTuesday, November 29, 2011
About	  me                                        @JacobSingh                                    http://jacobsingh.name   ...
About	  movember                      @JacobSingh                        HTTP://TINYURL.COM/JACOBMO       Lover           ...
What	  do	  programmers	               hate	  more	  than	                     anything?	  Tuesday, November 29, 2011
Work	  that	  isTuesday, November 29, 2011
TediousTuesday, November 29, 2011
&	  RepetitiveTuesday, November 29, 2011
IntroducingTuesday, November 29, 2011
Drush!Tuesday, November 29, 2011
Drupal	  +	  shellTuesday, November 29, 2011
What	  the	  shell?Tuesday, November 29, 2011
The	  Shell    •      a.k.a.	  Terminal,	  Command	  Line,	  CLI    •      Type	  commands	  to	  interact	  with	  your	 ...
Tuesday, November 29, 2011
Exercise:	  Open	  the	  shellTuesday, November 29, 2011
Windows    • Click	  on	  Start    • Type	  “cmd”	  into	  the	  program	  search    • Hit	  enter	  to	  select	  the	  c...
OSX    • Go	  to	  Applications	  -­‐>	  Utilities    • Click	  on	  terminalTuesday, November 29, 2011
Exercise:	  Installing	  DrushTuesday, November 29, 2011
pear channel-discover pear.drush.org         pear install drush/drush                      * Windows is a little different...
Why	  Drush?    • Speed    • AutomationTuesday, November 29, 2011
Drush	  can	  do	  a	  lot	  of	                               thingsTuesday, November 29, 2011
command (cmd)                               description.Tuesday, November 29, 2011
Let’s	  try	  a	  fewTuesday, November 29, 2011
cache-clear (cc)                      Clear a specific cache, or all                              drupal caches.Tuesday, N...
Exercise:	  Download	  DrupalTuesday, November 29, 2011
pm-download (dl)          Download projects from drupal.org or                     other sources.Tuesday, November 29, 2011
Downloading	  Drupal                             Drush dl drupalTuesday, November 29, 2011
Exercise:	  Install	  DrupalTuesday, November 29, 2011
Tuesday, November 29, 2011
site-install (si)              Install Drupal along with modules/                themes/configuration using the           ...
drush site-install           Could not find a Drupal settings.php file                at ./sites/default/settings.php.    ...
Pass --db-url optionTuesday, November 29, 2011
Pass --db-url option.Tuesday, November 29, 2011
Drush	  command	  Structure                Command      Options   ArgumentsTuesday, November 29, 2011
Examples          site-install           --db-url=mysql://....                 Run the install command, using the db-url  ...
Most	  important	                                 option!!!!Tuesday, November 29, 2011
--helpTuesday, November 29, 2011
site-install --help                Lists all of the options and arguments for the site-                     install comman...
Exercise:	  Adding	  modulesTuesday, November 29, 2011
Download	  views                Drush dl     viewsTuesday, November 29, 2011
Project views (7.x-3.0-rc3)         downloaded to www/sites/all/modules/                        views.          Project vi...
Exercise:	  Enabling	  modulesTuesday, November 29, 2011
pm-enable (en)                        Enable one or more extensions                            (modules or themes).Tuesday...
Enable	  views                Drush en views views_uiTuesday, November 29, 2011
Any	  questions	  before	  we	  continue?Tuesday, November 29, 2011
Updating	  modules                Drush dl             webform-7.x-3.11                Drush en            webform        ...
pm-updatecode (upc)                      Update Drupal core and contrib                      projects to latest recommende...
updatedb (updb)            Apply any database updates required               (as with running update.php).Tuesday, Novembe...
But	  there’s	  more!Tuesday, November 29, 2011
Forget the password?                             user-login (uli)             Display a one time login link for           ...
$ drush uli           http://localhost/?q=user/reset/         1/1322445074/5wbzEG1jyjNZpbVRIasOjYa                 XvsY3cu...
Moving the database?                             sql-dump              Exports the Drupal DB as SQL using                 ...
sql-dump > /backups/                     site-backup.sql                 ssh user@host ‘drush                 sql-dump | g...
variable-set (vset)                             Set a variable.Tuesday, November 29, 2011
Take the site offline                                 drush vset                             maintenance_mode 1Tuesday, No...
watchdog-show (ws)                              Show watchdog messages.Tuesday, November 29, 2011
AliasesTuesday, November 29, 2011
Aliases    •      Used	  to	  run	  drush	  commands	  from	  anywhere.    •      Syntax:	  drush	  @myalias	  cc	  all   ...
$aliases[jacobsingh.local] = array(             uri => jacobsingh.local,             root => /Users/jacob/work/         en...
drush @jacobsingh.local                   cc all               Clears the cache on my                     local siteTuesda...
drush @training.test cc                    all           SSH’s into the training           site, clears the cache.Tuesday,...
But	  there’s	  more!Tuesday, November 29, 2011
Deployment    •      drush	  rsync    •      drush	  sql-­‐sync    •      drush	  site-­‐upgrade    •      archive-­‐dump	...
Maintenance	      •      search-­‐reindex    •      image-­‐flush    •      cache-­‐clear    •      watchdog-­‐showTuesday,...
Configuration	  management    • features-­‐update    • features-­‐diff    • features-­‐revertTuesday, November 29, 2011
User	  management    •      user-­‐add-­‐role    •      user-­‐create    •      user-­‐password    •      user-­‐blockTues...
Extendable    • 92	  addons	  available	  on	  Drupal.org    • Writing	  extensions	  is	  pretty	  easy!    • Examples:	 ...
drush.wsTuesday, November 29, 2011
Upcoming SlideShare
Loading in …5
×

How to Install, Use, and Customize Drush

3,924 views

Published on

View a recording of this presentation at http://www.acquia.com/resources/acquia-tv/conference/biggest-increase-your-drupal-productivity-how-install-use-and

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,924
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
46
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

How to Install, Use, and Customize Drush

  1. 1. Drush:  The  essential  Drupal  toolTuesday, November 29, 2011
  2. 2. About  me @JacobSingh http://jacobsingh.name Trainer Engineer SpeakerTuesday, November 29, 2011
  3. 3. About  movember @JacobSingh HTTP://TINYURL.COM/JACOBMO Lover Fighter WhiskersTuesday, November 29, 2011
  4. 4. What  do  programmers   hate  more  than   anything?  Tuesday, November 29, 2011
  5. 5. Work  that  isTuesday, November 29, 2011
  6. 6. TediousTuesday, November 29, 2011
  7. 7. &  RepetitiveTuesday, November 29, 2011
  8. 8. IntroducingTuesday, November 29, 2011
  9. 9. Drush!Tuesday, November 29, 2011
  10. 10. Drupal  +  shellTuesday, November 29, 2011
  11. 11. What  the  shell?Tuesday, November 29, 2011
  12. 12. The  Shell • a.k.a.  Terminal,  Command  Line,  CLI • Type  commands  to  interact  with  your  computer • Windows  =  DOS  and  PowerShell • Linux  /  OSX  =  bash,  sh,  rshTuesday, November 29, 2011
  13. 13. Tuesday, November 29, 2011
  14. 14. Exercise:  Open  the  shellTuesday, November 29, 2011
  15. 15. Windows • Click  on  Start • Type  “cmd”  into  the  program  search • Hit  enter  to  select  the  command  promptTuesday, November 29, 2011
  16. 16. OSX • Go  to  Applications  -­‐>  Utilities • Click  on  terminalTuesday, November 29, 2011
  17. 17. Exercise:  Installing  DrushTuesday, November 29, 2011
  18. 18. pear channel-discover pear.drush.org pear install drush/drush * Windows is a little different. See http://drush.wsTuesday, November 29, 2011
  19. 19. Why  Drush? • Speed • AutomationTuesday, November 29, 2011
  20. 20. Drush  can  do  a  lot  of   thingsTuesday, November 29, 2011
  21. 21. command (cmd) description.Tuesday, November 29, 2011
  22. 22. Let’s  try  a  fewTuesday, November 29, 2011
  23. 23. cache-clear (cc) Clear a specific cache, or all drupal caches.Tuesday, November 29, 2011
  24. 24. Exercise:  Download  DrupalTuesday, November 29, 2011
  25. 25. pm-download (dl) Download projects from drupal.org or other sources.Tuesday, November 29, 2011
  26. 26. Downloading  Drupal Drush dl drupalTuesday, November 29, 2011
  27. 27. Exercise:  Install  DrupalTuesday, November 29, 2011
  28. 28. Tuesday, November 29, 2011
  29. 29. site-install (si) Install Drupal along with modules/ themes/configuration using the specified install profile.Tuesday, November 29, 2011
  30. 30. drush site-install Could not find a Drupal settings.php file at ./sites/default/settings.php. Could not determine database connection parameters. Pass --db-url option .Tuesday, November 29, 2011
  31. 31. Pass --db-url optionTuesday, November 29, 2011
  32. 32. Pass --db-url option.Tuesday, November 29, 2011
  33. 33. Drush  command  Structure Command Options ArgumentsTuesday, November 29, 2011
  34. 34. Examples site-install --db-url=mysql://.... Run the install command, using the db-url “mysql://...” (no arguments) cache-clear theme Clear the theme cache (no options) dl --destination=/tmp/drupal drupal Download Drupal to /tmp/drupalTuesday, November 29, 2011
  35. 35. Most  important   option!!!!Tuesday, November 29, 2011
  36. 36. --helpTuesday, November 29, 2011
  37. 37. site-install --help Lists all of the options and arguments for the site- install command. Also provides examples.Tuesday, November 29, 2011
  38. 38. Exercise:  Adding  modulesTuesday, November 29, 2011
  39. 39. Download  views Drush dl viewsTuesday, November 29, 2011
  40. 40. Project views (7.x-3.0-rc3) downloaded to www/sites/all/modules/ views. Project views contains 2 modules: views, views_ui.Tuesday, November 29, 2011
  41. 41. Exercise:  Enabling  modulesTuesday, November 29, 2011
  42. 42. pm-enable (en) Enable one or more extensions (modules or themes).Tuesday, November 29, 2011
  43. 43. Enable  views Drush en views views_uiTuesday, November 29, 2011
  44. 44. Any  questions  before  we  continue?Tuesday, November 29, 2011
  45. 45. Updating  modules Drush dl webform-7.x-3.11 Drush en webform Drush upc --no-core webform Drush updatedbTuesday, November 29, 2011
  46. 46. pm-updatecode (upc) Update Drupal core and contrib projects to latest recommended releasesTuesday, November 29, 2011
  47. 47. updatedb (updb) Apply any database updates required (as with running update.php).Tuesday, November 29, 2011
  48. 48. But  there’s  more!Tuesday, November 29, 2011
  49. 49. Forget the password? user-login (uli) Display a one time login link for the given user account (defaults to uid 1).Tuesday, November 29, 2011
  50. 50. $ drush uli http://localhost/?q=user/reset/ 1/1322445074/5wbzEG1jyjNZpbVRIasOjYa XvsY3cuu9TK0ZaRsrk2QTuesday, November 29, 2011
  51. 51. Moving the database? sql-dump Exports the Drupal DB as SQL using mysqldump or equivalent.Tuesday, November 29, 2011
  52. 52. sql-dump > /backups/ site-backup.sql ssh user@host ‘drush sql-dump | gzip -’ | gunzip - | mysql localdbTuesday, November 29, 2011
  53. 53. variable-set (vset) Set a variable.Tuesday, November 29, 2011
  54. 54. Take the site offline drush vset maintenance_mode 1Tuesday, November 29, 2011
  55. 55. watchdog-show (ws) Show watchdog messages.Tuesday, November 29, 2011
  56. 56. AliasesTuesday, November 29, 2011
  57. 57. Aliases • Used  to  run  drush  commands  from  anywhere. • Syntax:  drush  @myalias  cc  all • myalias  could  be  local,  or  remote. • Stored  in  ~/.drushTuesday, November 29, 2011
  58. 58. $aliases[jacobsingh.local] = array( uri => jacobsingh.local, root => /Users/jacob/work/ engineering/gardens/trunk/docroot, ); $aliases[training.test] = array( root => /var/www/html/trainingstg/ docroot, remote-host => staging-9.network.hosting.acquia.com, remote-user => training, );Tuesday, November 29, 2011
  59. 59. drush @jacobsingh.local cc all Clears the cache on my local siteTuesday, November 29, 2011
  60. 60. drush @training.test cc all SSH’s into the training site, clears the cache.Tuesday, November 29, 2011
  61. 61. But  there’s  more!Tuesday, November 29, 2011
  62. 62. Deployment • drush  rsync • drush  sql-­‐sync • drush  site-­‐upgrade • archive-­‐dump  |  archive-­‐restore • test-­‐runTuesday, November 29, 2011
  63. 63. Maintenance   • search-­‐reindex • image-­‐flush • cache-­‐clear • watchdog-­‐showTuesday, November 29, 2011
  64. 64. Configuration  management • features-­‐update • features-­‐diff • features-­‐revertTuesday, November 29, 2011
  65. 65. User  management • user-­‐add-­‐role • user-­‐create • user-­‐password • user-­‐blockTuesday, November 29, 2011
  66. 66. Extendable • 92  addons  available  on  Drupal.org • Writing  extensions  is  pretty  easy! • Examples:  ApacheSolr,  Backup  and  Migrate,  Coder,   Simpletest,  Views,  Devel  Generate.Tuesday, November 29, 2011
  67. 67. drush.wsTuesday, November 29, 2011

×