• Save
Intro to Drush
Upcoming SlideShare
Loading in...5
×
 

Intro to Drush

on

  • 7,591 views

An introduction to the the who, what, why when and how of Drush, the command line utility for Drupal. Presentation given at the Sacramento Drupal Users Group meeting on 6/15/2011

An introduction to the the who, what, why when and how of Drush, the command line utility for Drupal. Presentation given at the Sacramento Drupal Users Group meeting on 6/15/2011

Statistics

Views

Total Views
7,591
Views on SlideShare
5,659
Embed Views
1,932

Actions

Likes
3
Downloads
0
Comments
1

13 Embeds 1,932

http://carsonblack.com 1344
http://www.carsonblack.com 417
http://dev.carsonblack.com 56
http://nextleveldrupal.local 36
http://nextleveldrupal.com 24
http://surfmagix.com 20
http://worldofdrupal.local 15
http://www.ostraining.com 10
http://www.nextleveldrupal.com 5
http://dev.new.com 2
http://cblack.prod2.webenabled.net 1
http://cblack.dev3.webenabled.net 1
http://74.6.238.254 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

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
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • USERS is last\nOn to more detail...\n
  • USERS is last\nOn to more detail...\n
  • USERS is last\nOn to more detail...\n
  • USERS is last\nOn to more detail...\n
  • USERS is last\nOn to more detail...\n
  • \n
  • \n
  • \n
  • 2 commands shown here! + extra flag \n
  • \n
  • BUILD: Minor and Major update shown\n
  • \n
  • BUILD: types it out\n
  • st = Drupal version, Site URI, Database driver, Database hostname, Database username, Database name, Default theme, Administration theme, PHP configuration, Drush version, Drush configuration, Drush alias files, Drupal root, Site path, File directory path\n\nvget = dump all vars decently formatted arrays, or for specific var\n\nWORKING WITH FIELDS NEXT\n
  • field-create: arg is the content type then there is a dialog of choices for the field\nfield-info: kind of broken\n\nWORKING WITH MODULES NEXT\n
  • \n
  • \n
  • BUILD: update-code + update.php\n
  • can also use sm but it will give deprecated warning\ntip: grep for particular module\n\nWORKING WITH DATABASE NEXT\n
  • \n
  • \n
  • \n
  • drop all tables\n
  • NEXT: WORKING WITH USERS\n
  • \n
  • anonymizes content this person authored\n
  • TIP: can use uid, name, email\n
  • \n
  • \n
  • Returns: uid, name, mail, roles, status\n\nNEXT: WHAT IT DOESN’T DO\n
  • BUILD: anything with content - Create, edit, delete nodes\n\nNEXT: DO MORE - MODULES\n
  • BUILD: list of modules\n
  • NEXT: DRUSH ALIASES\n
  • BUILD: 1) alias config 2) enable token 3) sql-sync\n\nNEXT: DRUSH MAKE\n
  • BUILD: 1) alias config 2) enable token 3) sql-sync\n\nNEXT: DRUSH MAKE\n
  • BUILD: 1) alias config 2) enable token 3) sql-sync\n\nNEXT: DRUSH MAKE\n
  • BUILD: 1) example\n2) Extension\n3) prepares site\n4) single text file\n5) automates\nNEXT: INSTALL PROFILES\n
  • BUILD: 1) example\n2) Extension\n3) prepares site\n4) single text file\n5) automates\nNEXT: INSTALL PROFILES\n
  • BUILD: 1) example\n2) Extension\n3) prepares site\n4) single text file\n5) automates\nNEXT: INSTALL PROFILES\n
  • BUILD: 1) example\n2) Extension\n3) prepares site\n4) single text file\n5) automates\nNEXT: INSTALL PROFILES\n
  • BUILD: 1) example\n2) Extension\n3) prepares site\n4) single text file\n5) automates\nNEXT: INSTALL PROFILES\n
  • BUILD: 1) example\n2) works like module\n3) script custom install\n\nNEXT: INSTALLATION\n
  • BUILD: 1) example\n2) works like module\n3) script custom install\n\nNEXT: INSTALLATION\n
  • BUILD: 1) example\n2) works like module\n3) script custom install\n\nNEXT: INSTALLATION\n
  • NEXT: SORRY WINDOWS USERS...\n
  • BUILD: NO DRUSH FOR YOU\n\nNEXT: OTHER INSTALL OPTIONS\n
  • Download using bittorrent\n\nVirtual Machine - needs RAM\n\n
  • A bit of a hassle to get going. Ask GaryB\n
  • \n
  • \n
  • \n
  • \n
  • NEXT: Resources\n
  • NEXT: FIN\n
  • \n

Intro to Drush Intro to Drush Presentation Transcript

  • Intro to Drush• Who is it for?• What is it?• Why should you use it?• When should you use it?• How do you use it?
  • What is Drush?
  • What is Drush?A command line interface for managing your Drupal website.
  • What is Drush?A command line interface for managing your Drupal website. $ drush cc
  • Do I really need it?
  • Do I really need it?• No. But you REALLY want it!
  • Do I really need it?• No. But you REALLY want it!• Useful during development process
  • Do I really need it?• No. But you REALLY want it!• Useful during development process• For those maintaining multiple sites
  • Do I really need it?• No. But you REALLY want it!• Useful during development process• For those maintaining multiple sites• +1 Drupal Street Cred...
  • Do I really need it?• No. But you REALLY want it!• Useful during development process• For those maintaining multiple sites• +1 Drupal Street Cred...• (you look like a real smartypants)
  • What Can Drush Do For Me?
  • What Can Drush Do For Me?• Work with Drupal Core
  • What Can Drush Do For Me?• Work with Drupal Core• Work with Fields (D7)
  • What Can Drush Do For Me?• Work with Drupal Core• Work with Fields (D7)• Work with Contrib Modules
  • What Can Drush Do For Me?• Work with Drupal Core• Work with Fields (D7)• Work with Contrib Modules• Work with Database
  • What Can Drush Do For Me?• Work with Drupal Core• Work with Fields (D7)• Work with Contrib Modules• Work with Database• Work with Users
  • •Work with Drupal Core Clear Cache $ drush cc
  • •Work with Drupal Core Run Cron $ drush cron
  • •Work with Drupal Core Run update.php $ drush updb
  • •Work with Drupal Core Empty watchdog (log) table $ drush wd-del
  • •Work with Drupal Core Empty watchdog (log) table $ drush wd-del $ drush wd-del --type=cron
  • •Work with Drupal Core Index content for search $ drush search-index $ drush search-reindex
  • •Work with Drupal Core update core minor (7.1→7.2) $ drush up
  • •Work with Drupal Core update core minor (7.1→7.2) $ drush up update core major (6.x→7.x) $ drush sup
  • •Work with Drupal Core run tests $ drush test-run --all
  • •Work with Drupal Core Install Drupal (D7)
  • •Work with Drupal Core Install Drupal (D7)$ drush si --db-url=mysql://root:pass@localhost/port/dbname --account-pass=abc123 --account-mail=admin@example.com --site-name=My Site
  • •Work with Drupal Core Status & Being Nosy $ drush st $ drush search-status $ drush vget
  • •Work with Fields (D7) Clone, Create, Delete, Get Info $ drush field-create article $ drush field-clone tags labels $ drush field-delete article $ drush field-info article
  • •Work with Modules Download $ drush dl cck views token
  • •Work with Modules enable / disable$ drush en content text views views_ui$ drush dis content text views views_ui
  • •Work with Modules update $ drush up
  • •Work with Modules update $ drush up = $ drush upc + $ drush updb
  • •Work with Modules status (enabled/disabled/ver.) $ drush pm-list
  • •Work with your Database TIP: make sure mysql command exists $ mysql -uroot -p
  • •Work with your Database execute queries $ drush sql-query “SELECT * FROM {users} WHERE uid=1”
  • •Work with your Database export DB as SQL (mysqldump) $ drush sql-dump --result-file=../06_15_2012.sql
  • •Work with your Database drop (YIKES! BE CAREFUL!) $ drush sql-drop
  • •Work with your Database sync (rsync copy and import) $ drush sql-sync @prod @stage
  • •Work with your Users Create Users$ drush ucrt dustyb --mail=”dusty@sacdrupal.com” --password=”abc123”
  • •Work with your Users Cancel Users (anonymizes content) $ drush ucan dustyb
  • •Work with your Users Block Users $ drush ublk dustyb Unblock Users $ drush uublk dustyb
  • •Work with your Users Add Role to User $ drush urol “admin” dustyb Remove Role from User $ drush urrol “admin” dustyb
  • •Work with your Users Reset User’s Password$ drush upwd dustyb --password=”t&ur@tles”
  • •Work with your Users Get User Info $ drush uinf dustyb
  • What Drush Doesn’t Do
  • What Drush Doesn’t Do Anything with your content!
  • Do Even More...
  • Do Even More...• Devel Module• Backup and Migrate• Views Bulk Operations• XML Sitemap• Node Export• Apache Solr Search Integration• Module Builder• Coder• Features, Views and CTools• Many more....
  • Do Even More...
  • Drush Aliases aliases.drushrc.php
  • Drush Aliases aliases.drushrc.php$aliases[example_stage] = array( uri => staging.example.com, root => /var/www/stage_example, db-url => mysqli://root:pass@localhost/example_stage,);$aliases[example_prod] = array( uri => www.example.com, root => /var/www/example, db-url => mysqli://root:pass@localhost/example_prod, remote-host => 192.232.232.33’, remote-user => carsonbl’,);
  • Drush Aliases aliases.drushrc.php$aliases[example_stage] = array( uri => staging.example.com, root => /var/www/stage_example, db-url => mysqli://root:pass@localhost/example_stage,);$aliases[example_prod] = array( uri => www.example.com, root => /var/www/example, db-url => mysqli://root:pass@localhost/example_prod, remote-host => 192.232.232.33’, remote-user => carsonbl’,); $ drush @example_stage en token
  • Drush Aliases aliases.drushrc.php$aliases[example_stage] = array( uri => staging.example.com, root => /var/www/stage_example, db-url => mysqli://root:pass@localhost/example_stage,);$aliases[example_prod] = array( uri => www.example.com, root => /var/www/example, db-url => mysqli://root:pass@localhost/example_prod, remote-host => 192.232.232.33’, remote-user => carsonbl’,); $ drush @example_stage en token $ drush sql-sync @example_prod @example_stage
  • Drush Make
  • Drush Make$ drush make example.makeexample
  • Drush Make $ drush make example.make example• Extension to Drush
  • Drush Make $ drush make example.make example• Extension to Drush• Prepares your site for installation
  • Drush Make $ drush make example.make example• Extension to Drush• Prepares your site for installation• Create complicated Drupal distribution using a single text file
  • Drush Make $ drush make example.make example• Extension to Drush• Prepares your site for installation• Create complicated Drupal distribution using a single text file• Automates download of core, modules, patches, external libraries and external code from repos
  • Installation Profiles
  • Installation Profiles $ drush si example
  • Installation Profiles $ drush si example• Works and set up like a module
  • Installation Profiles $ drush si example• Works and set up like a module• Allows you to script custom installation process
  • Drush Installation• Download http://drupal.org/project/ drush• Follow Installation Instructions in README.txt
  • Sorry Windows Users...
  • Sorry Windows Users... No Drush for you!!!
  • Other Install Options• Drupal Quickstart Project • drupal.org/project/quickstart • Pre-packaged PHP/LAMP development environment (Ubuntu) • Drush is pre-installed and ready to go!
  • Other Install Options• Cygwin (http://www.cygwin.com/) • Makes Windows kind of act like Linux • will have to set up a complete development environment
  • Other Install Options• WebEnabled (webenabled.com) • web-based development environment • Drush pre-installed • Also have simplistic web app in control panel to do drush visually • Free development environments!
  • Other Install Options• Acquia Dev Cloud (acquia.com) • web-based development environment • Drush pre-installed • full dev-stage-prod hosting environment • $149 /mo.
  • Other Install Options• Pantheon (getpantheon.com) • web-based development environment • Drush pre-installed • full dev-stage-prod hosting environment • aliases for each environment configured
  • Other Install Options• Your Hosting • Must have shell access! • You will have to install
  • Other Install Options• Get a Mac! ;-)• Dual-boot Linux• Install Linux
  • Resources• http://drush.ws - full documentation• http://drupal.org/project/drush• http://nuvole.org/blog/drush - check out the shortcuts• http://drupal.org/project/drush_make
  • Thank Youcarsonblack.com