Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to Drush - 27 Feb 2013


Published on

Presentation about Drush (Drupal Shell) by Anthony Albertyn from #drupalcambs meetup.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Introduction to Drush - 27 Feb 2013

  1. 1. Anthony Albertyn #drupalcambs
  2. 2. WHAT IS DRUSH?• Drush = Drupal Shell• Command line interface• More productive than GUI• Toolbox of useful utilities• Scripting environment that can be extended• Not a Drupal module – need to install it differently• Download it at:
  3. 3. WHAT CAN WE DO WITH DRUSH?• Drush can act on Drupal: • Modules • Themes • Profiles • Translations• Drush can perform the following tasks: • Download • Enable / Disable • Update (including core) • Uninstall
  4. 4. WHAT ELSE CAN WE DO WITH DRUSH?• Perform various administration tasks like: • Clear cache • Run cron • Re-index search• Trigger SQL queries like: • Backup your database • Migrate databases between environments• Use Drush commands made available by contrib modules, like: • Creating a sub-theme in Omega (Omega Tools) • Export a feature from your site into a module (Features)
  5. 5. HOW TO USE DRUSH• Make sure you have installed Drush on your computer or server – useful advice ;-)• Open up your terminal / shell application• Navigate to the directory where your Drupal settings file is located*• Type in your Drush command and press enter• Type: drush help for list of common drush commands * not required to navigate to directory if you have setup Drush site aliases
  6. 6. DOWNLOAD AND ENABLE MODULES / THEMES• drush dl views downloads views module• drush en views enables views module• drush dl omega download omega theme• drush en omega enable omega theme• drush dl date pathauto entity redirect download multiple modules• drush en date redirect entity enable multiple modules
  7. 7. DISABLE AND UNINSTALL MODULES• drush dis views disables the view module• drush pm-uninstall views uninstalls the views module• drush dis pathauto email date disable multiple modules• drush pm-uninstall pathauto email date uninstall multiple modules
  8. 8. USEFUL ADMIN TASKS• drush cc all clears all caches• drush cron runs cron• drush status shows database status and other useful info• drush pm-list lists of available modules and themes (whether enabled + version)• drush pm-info views gives info about a specific module
  9. 9. SQL AND OTHER COMMANDS• drush sql-dump --result-file=../mydump.sql exports database into sql file• drush sql-sync uses user-defined aliases to copy over an entire database content (using sql) from one environment to another. In this case from a dev site to a live site. @ symbol indicates an alias.• drush rsync copies over the files folder content froma live site to a dev site using site aliases.• drush sa list all defined site aliases that you have• For more info on setting up site aliases, see “Using drush to synchronise and deploy sites” community documentation:
  10. 10. CREATE AND ACT ON MAKE FILES• A make file is a kind of info file that drush uses to replicate a drupal site. It describes all the modules, themes, extensions etc.• To create a make file of your current site, do the following: • drush generate-makefile mysite.make • open the make file and check that everything is good )note the to-do’s)• To use a make file, do this: • Create an empty directory in your htdocs folder • Place mysite.make inside that directory and navigate to it • drush make mysite.make
  11. 11. CREATE AN INSTALL PROFILE (EXISTING SITE)• An install profile is a Drupal configuration (example: Open Atrium)• drush dl profile_builder• drush en profile_builder• drush distro mydistro --untar• drush will place the new profile in the /profile folder of your site (also includes a make file of your site)• For more information, see:
  12. 12. FURTHER READING• Free Chapter on Drush – Chap 26, The Definitive Guide to Drupal 7•• For more resources, just Google it – don’t be lazy! #drupalcambs @anthonyalbertyn