Skip to content

Instantly share code, notes, and snippets.

@sprice
Created June 2, 2010 22:38
Show Gist options
  • Save sprice/423121 to your computer and use it in GitHub Desktop.
Save sprice/423121 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Sync a Drupal database and contents of files directory between two
# development environments.
#
# Execute this script on the destination (DEST) server.
# A MEMBERNAME.aliases.drushrc.php file is required on the SOURCE server.
# See http://gist.github.com/421721 and remove example.local alias
# edit the following variables
DEST_ALIAS="example.dev"
SOURCE_ALIAS="example.stage"
DEST="sites/dev.example.com"
SOURCE="sites/stage.example.com"
# Do not edit below this line
FILES_QUERY="UPDATE {files} SET filepath=replace(filepath, '$SOURCE', '$DEST');"
drush sql-sync @$SOURCE_ALIAS @$DEST_ALIAS
drush rsync @$SOURCE_ALIAS:%files @$DEST_ALIAS:%files
drush @$DEST_ALIAS sqlq "$FILES_QUERY"
drush @$DEST_ALIAS vset file_directory_path "$DEST/files"
drush @$DEST_ALIAS cc all
# Set the password for user 1 to 'admin'
# drush @DEST_ALIAS sqlq "UPDATE users SET pass = '21232f297a57a5a743894a0e4a801fc3' WHERE uid = 1"
# Turn off performance variables
# drush @$DEST_ALIAS vset --yes cache 0
# drush @$DEST_ALIAS vset --yes cache_lifetime 0
# drush @$DEST_ALIAS vset --yes page_compression 0
# drush @$DEST_ALIAS vset --yes block_cache 0
# drush @$DEST_ALIAS vset --yes preprocess_css 0
# drush @$DEST_ALIAS vset --yes preprocess_js 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment