Getting started with Drush

Post on 12-Nov-2014

5,176 views 0 download

Tags:

description

A very quick presentation presented at NWDUG (North West Drupal User Group) to explain some of the commands I commonly use, as well as how to get started with Drush.

transcript

DRUSHDRUpal SHell Basics

stemount, NWDUG August 20th 2010

IT HAS PLENTY OF COMMANDSTo automate the administration of your Drupal site

WHAT DO THE COMMANDS DO?• Download modules/themes• Enable/Disable modules/

themes• Installs Drupal providing

you have a install profile• Updates Drupal• Reindexes search• Clears caches• Run cron

USEFUL COMMANDS

drush si (Site Install)This installs Drupal with your install profile.

drush dl [module/theme name]Download a specified module/theme name

drush en [module/theme name]This enables a theme/module

USEFUL COMMANDS

drush smLists all modules and themes. - good for debugging performance and cleaning up to go live

drush cliEnters a Drush-only mode so you do not have to continuously type “drush command”

drush search-indexIndexes the site for the core search module without need to run cron

DRUSH UPDATE

drush upUpdates your Drupal install and patches security vulnerabilities, fixes bugs and (sometimes) includes performance tweaks

backup before you use Drush update. This make break your website.

DRUSH UPDATE

drush upUpdates your Drupal install and patches security vulnerabilities, fixes bugs and (sometimes) includes performance tweaks

HOW TO GET STARTED

• The Drush install script kindly written by me!

• You can find the Drush install script on GitHub but will also be released on my blog with these slides.

•Download it from CVS

•Download it from Drupal.org, read the documentation and install manually

WHAT DO I DO WHEN I HAVE DRUSH?

Simply type “drush” into Terminal / a CLI on your machine to get a list of commands

WHAT DO I NEED TO HAVE FOR DRUSH

You need a UNIX/Linux/Mac OS X to use Drush

It will work on Windows, see http://tohin.wordpress.com/2009/07/14/drush-power-tool-drupal-winxp/ however it is not made for Windows and this is a hack.

BACKING UP A SITE

You wouldn’t use Drush for the time beingIt is to be automated in the future with the command “drush bam backup” however until then, it’s best to use the backup_migrate module

Use admin_menu (http://dgo.to/admin_menu) to navigate straight to a Quick Backup

2- Step Process

Use the drop-down box to select if you wish to download to your machine or keep on the server

Click “backup now”

1 2

Similarly, you can use the “restore” feature to restore a database backup from backup_migrate

UPLOAD A BACKUP FILE AND RESTORE A DATABASE

THIS IS ONLY THE DATABASE THOUGH, YOU HAVE TO BACKUP THE FILES TO

YOUR SITE.

THAT’S UP TO YOU HOW YOU WANT TO DO THAT.

GIT, TAR, AUTOMATED CRONJOB, BACKUP TO S3, BACKUP TO TAPE, DOWNLOAD FILES FROM YOUR CONTROL PANEL, LOG INTO YOUR FTP OCCASIONALLY AND DOWNLOAD THE FILES, USE AN AUTOMATION MODULE, IT GOES ON AND ON

AND I WOULDN’T WANT TO WASTE ANY MORE OF OUR VALUABLE TIME

THE KEY TO SUCCESS WITH BACKING UP

REGULARLY TESTING YOUR BACKUP ON A VANILLA INSTALL JUST IN CASE SOMETHING EVER DOES GO HORRIBLY

WRONG.

AND YOUR CLIENT / FRIEND / SIBLING / FRIEND OF A FRIEND DOESN’T LOSE THEIR SITE!