drush

Complete

drush is a command line tool for managing Drupal sites.  The following is not intended to be a drush manual, but simply a quick cheat-sheet for how to do various things.

The correct directory. For drush to work you have to be in an appropriate directory.  In our case, having logged in as admin, cd to www .  If you want to work on the test system (rather than the production system), cd to ~/public_html/test.openvpms.org .

Download a module. Use "drush dl <module_name>" - eg

  drush dl uc_extra_field_pane

Note that drush will grab the appropriate revision of the module.  You can then enable the module using "drush en <module_name>".  In some cases the download will infact contain more than one module, and in this case you have to enable each separately.

Sync database. Use "drush sql-sync  <from> <to>" - eg

  drush sql-sync @live @test

@live is the site alias for the production system, @test that for the test system

Site on/off-line. If you are going to do work on the system you should take it offline before starting work, and put it back online after.  This is done via the page

http://openvpms.org/?q=admin/settings/site-maintenance

or for the test system

http://test.openvpms.org/?q=admin/settings/site-maintenance

Update Drupal core. If you need to do this (say for a security update), then do as follows after setting the Site offline (see above):

First backup things - just in case:
The command is:

drush archive-dump --destination=/tmp/tg-archive.tar --tar-options="--exclude=.git"

Note that we are just archiving to a file in the /tmp directory - after all is updated and verified to be working, this file can and should be deleted.

Now the update(s). Here we do updates to the core, and then the cck and mollom modules using the commands:

drush up drupal
drush up cck
drusk up mollom

 

Then have a play to check things out, then put the site back online.