Introduction to Drush - DrupalCamp London 2014
Upcoming SlideShare
Loading in...5
×
 

Introduction to Drush - DrupalCamp London 2014

on

  • 603 views

Presentation at DrupalCamp London 2014 about using Drush, the Drupal shell.

Presentation at DrupalCamp London 2014 about using Drush, the Drupal shell.
Audio/video available here: http://youtu.be/XB4of9ev4Ts

Statistics

Views

Total Views
603
Views on SlideShare
603
Embed Views
0

Actions

Likes
0
Downloads
5
Comments
1

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Lists modules and themes for a site, their versions and whether endbled/disabled
  • Shows detailed info about one or more modules or themes
  • Remember you can use aliases with anydrush command, like getting status of remote site
  • Remember you can use aliases with anydrush command, like getting status of remote site
  • Short versions are ublk to block, uublk to unblock
  • Short versions are ublk to block, uublk to unblock
  • Short versions are ublk to block, uublk to unblock
  • Short versions are ublk to block, uublk to unblock
  • Short versions are ublk to block, uublk to unblock
  • Defaults to uid 1
  • Defaults to uid 1
  • Short versions are ublk to block, uublk to unblock

Introduction to Drush - DrupalCamp London 2014 Introduction to Drush - DrupalCamp London 2014 Presentation Transcript

  • Introduction to Drush $ @anthonyalbertyn $ #dclondon $z
  • What is Drush?  Drush = Drupal Shell  Command line interface  Scripting environment that can be extended  Toolbox of useful utilities
  • Why use Drush?  Can be massively more productive than using a GUI  Access drush commands supplied by contrib modules
  • What can Drush do?  Perform tasks with modules, themes, profiles, translations and core: - download, enable, update, - disable and uninstall  Add, remove and manage users
  • What else can Drush do?  Various admin tasks like clear cache, run cron, re-index search  Database related tasks like backup database, migrate databases between different sites
  • What do we need to use Drush locally ?  Install Drush on your pc/mac  Terminal / Windows Command Processor (command prompt)
  • What do we need to use Drush remotely ?  Install Drush on server  SSH client - for Mac use Terminal - for Windows install and use PuTTY
  • Options for installing Drush     Use PEAR (preferred way) Install Drush manually There are other ways too Instructions for various environments: http://drupal.org/node/1791676
  • Two ways to use Drush  Navigate to your Drupal root directory on local or remote site and type: drush [command]  Setup a Drush site alias and locally from anywhere in Terminal type: drush @[alias] [command]
  • List useful Drush commands drush help
  • Download modules drush dl omega drush dl date context ds
  • Enable modules drush en omega drush en date context ds
  • Disable modules drush dis omega drush dis date context ds
  • Uninstall modules drush pm-uninstall omega drush pm-uninstall date ds
  • List modules and themes on site drush pm-list
  • More info on module in site drush pm-info context
  • Clear the cache drush cc drush cc all
  • Run cron on your site drush cron
  • Search status – how many items still need indexing drush search-status
  • Search index – index remaining search items without wiping out the existing index drush search-index
  • Search re-index – force the search index to be re-built drush search-reindex
  • List available site aliases drush sa
  • Show status of a site drush status drush @alias status
  • Get info about an existing user drush user-information username drush user-information userid drush user-information useremail
  • Block and unblock a user drush user-block username drush user-unblock username
  • Create a new user drush user-create username --mail=“eg@example.com” --password=“password123”
  • Give a user a role drush user-add-role ”user role” username
  • Set a new password for a user drush user-password username -password=“newpass123”
  • One-time login link for a user drush uli username drush @alias uli username
  • Delete a user account drush user-cancel username
  • Update drupal core and contrib modules to latest recommended releases and apply pending database updates drush up
  • Dump database into sql file drush sql-dump > /path/to/ myfile.sql
  • Copy entire database from one environment to another drush sql-sync @site1 @site2
  • Sync files folder content from one site to another drush rsync @site1:%files @site2:%files
  • More info on deploying sites drush help site-alias drush help sql-sync drush help rsync
  • Setup and use Drush aliases  Blog post about Drush aliases http://www.astonishdesign.com/blog/drushaliases-what-why-and-how  Synchronise and deploy sites http://drupal.org/node/670460  Example of valid alias statements http://drush.ws/examples/example.aliases.drushrc.p hp
  • Manual installation on Mac  Download Drush from GitHub http://github.com/drush-ops/drush  Unpack into home directory /Users/username  Grant yourself file execution permissions chmod u+x /Users/username/drush/drush
  • Manual installation on Mac  Tell OS X where to find Drush:  Add drush path to your $PATH - via Terminal - or Bash - or Profile  OR create a symbolic link to the path
  • Mac – add Drush to path  Example: In directory /Users/username, edit .profile and add: export PATH=$PATH:/Users/username/drush/drush
  • Mac – create symbolic link  Example sym link: cd /usr/bin ln –s /Users/username/drush/drush  More info mac installation: http://drupal.org/node/1674222 http://drupal.org/node/508450
  • Test that Drush works  Open your Terminal and type drush --version  To display a list of helpful drush commands: drush help
  • Learning resources  Drush User’s Guide (book) Novillo, J.P, Packt Publishing, 2012 ISBN 978-1-84951-798-0  Drush for Humans – SANDcamp 2013 Presenter: Jon Peck https://www.youtube.com/watch?v=Pp6UofwFMDw
  • Learning resources  Drush optimizations for your development workflow – DrupalCon Prague 2013 Presenters: various https://prague2013.drupal.org/session/drushoptimizations-your-development-workflow
  • Drush resources  Drush commands http://www.drush.org  Drush GitHub project http://github.com/drush-ops/drush  Drush Windows installer http://drush.ws/drush_windows_installer  Drush API docs http://api.drush.ws
  • About me  @anthonyalbertyn  Front-end web developer  Co-founder and organiser of #drupalcambs  http://www.meetup.com/drupalcambs