drush to simplify drupalers work - sivaji
TRANSCRIPT
Drush to
simplify
Drupalers workSivaji J.G,
KnackForge Soft Solutions Pvt. Ltd.
About Speaker
• Started Drupal evangelism as trainee in 2008
• Integrated Drupal and gnokii for accessing bus routes
information via SMS
• GSoC Alumnus 2009
• Co-maintainer of quiz module
• Contributor to Drupal Core and Contrib modules in drupal.org
• Technical reviewer of Drupal books
• Featured Speaker / Trainer of Drupal Chennai workshops
• Technical Director / Drupal project manager at KnackForge
Agenda
• What is Drush?
• Requirements and Installation
• How it works?
• Drush commands
What is Drush?
• Command line utility to administer Drupal sites
• Typically used as “drush [options] <command>
[argument1] [argument2]”
• Commonly used for cache clear, managing modules /
themes / features, cron, etc.
• Supports Drupal 6.x and above
• Works best on Unix like OS and partially supported
for Windows
• Maintained in GitHub /drush-ops/drush
Requirements and Installation
• From PEARo https://github.com/drush-ops/drush#install---pear
• Manual Installationo https://github.com/drush-ops/drush#install---manual
How it works
Drush Commands
• pm-download
• site-install
• user-password
• variable-get / set
• cache-clear
• core-cron
• core-status
• php-script
• updatedb
•
• watchdog-show
• pm-list
• pm-enable
• pm-disable
• pm-uninstall
• sql-drop
• sql-query
• sql-sync
• sql-connect
•
$ drush pm-download (dl)
• Download any projects from drupal.org
• Project could Drupal core, modules, themes or
profiles.
• Handles project dependency
• Sticks to recommended versions by default
• Automatically figure out which project version you
want based
• Integrates with version control system (git, svn
and bzr)
$ drush pm-download (dl)
Usage
$ drush dl
Project drupal (7.23) downloaded to
/home/sivaji/Public/drupal-7.23. [success]
Project drupal contains: [success]
- 3 profiles: standard, testing, minimal
- 4 themes: bartik, garland, stark, seven
- 47 modules: image, openid, simpletest,...
$ drush pm-download (dl)
$ drush dl views
Project views (7.x-3.7) downloaded to
/home/sivaji/Public/drupal-7.23/sites/all/modules/views.
[success]
$ drush dl zen
$ drush dl features-7.x-2.x-dev
$ drush site-install (si)
Installs Drupal with specified install profile
Usage
• $ drush si standard --site-name="Drush
Test"
• --db-url=<mysql://root:[email protected]/db
• More default values o --account-mail, --account-name, --db-prefix, --locale,
--site-mail, [form name].[parameter name]
$ drush site-install (si)
$ drush si standard --site-name="Drupal Camp" --db-
url=mysql://[email protected]/learning_drush
You are about to create a sites/default/files directory and create a
sites/default/settings.php file and CREATE the 'learning_drush' database.
Do you want to continue? (y/n): y
Starting Drupal installation. This takes a few seconds ...
[ok]
Installation complete. User name: admin User password: AGn744iDVd
$ drush user-password (upwd)
(Re)Set the password for the user account with the
specified name
Usage:
Changing the auto generated password AGn744iDVd to
Admin!@# for admin user.
$ drush upwd admin --password=Admin!@#
$ drush variable-get / variable-set
(vget/vset)
Get a list of some or all site variables and
values.
Usage
$ drush variable-get site_name
site_name: "Drupal Camp"
$ drush variable-set site_name "Drupal Camp
Delhi"
$ drush cache-clear (cc)
Clear a specific cache, or all drupal caches
Usage,
$ drush cc all
$ drush cc menu
$ drush cache-clear (cc)
$ drush cc
Enter a number to choose which cache to clear.
[0] : Cancel
[1] : all
[2] : drush
[3] : theme-registry
[4] : menu
[5] : css-js
[6] : block
[7] : module-list
[8] : theme-list
[9] : registry
[10] : token
[11] : views
More slides to come