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: http://www.drupal.org/project/drush
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
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)
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
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
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
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
SQL AND OTHER COMMANDS• drush sql-dump --result-file=../mydump.sql exports database into sql file• drush sql-sync @mysite.dev @mysite.live 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 @mysite.live:%files @mysite.dev:%files 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: http://drupal.org/node/670460
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
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: http://drupal.org/project/profile_builder
FURTHER READING• Free Chapter on Drush – Chap 26, The Definitive Guide to Drupal 7 http://definitivedrupal.org/book/26-drush• http://www.drush.ws• http://www.drupal.org/project/drush For more resources, just Google it – don’t be lazy! www.meetup.com/drupalcambs #drupalcambs @anthonyalbertyn
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.