Drupal Freshen
Easily freshen up your Drupal dev or staging environments.
INSTALL...
1. Place the freshen script at: usr/local/bin/freshen
2. Change things for your setup. Read on.
3. Create a backups/scheduled and/or backups/manual folder in your project root.
THINGS TO CHANGE...
1. Constants:
This set of variables will adapt the script to your setup.
It includes folder names, URLs, etc.
2. Dev Environment Settings:
No doubt you'll want a few changes to your setup which can't be accomplished
via variables in your settings.local.php file. Edit drush commands here.
ASSUMPTIONS...
1. You have a master project folder with a site folder within it.
2. Remote DB backups are un-gzip-able.
3. You don't mind local backups going into a "backups" folder within you project.
3. You used and Git ignore a "sites/default/files" directory for uploads.
5. For complete wipes and brand new setups, you need to git ignore and maintain
side-by-side dev environment config file backups of the following files.
The normal path will be restored by the script, it's assumed you have these
files in your drupal path.
A. htaccess.txt
B. drushrc.php.txt
C. If you ignore sites/all/default/settings.php on production you'll need a
backup at sites/all/default/settings.php.txt (see notes for a better way).
NOTES...
1. You can point your files backup path to either a staging/dev files directory
or at an off-production backup folder.
2. To accomplish different environments settings:
A. Add a require_once() from settings.php to a settings.local.php which is
git ignored and environment specific, RECOMMENDED.
B. Use multisites and a git ignored folder for local settings. If you use
this setup then you'll need to also maintain a side-by-side backup for
sites/all/default/settings.php.txt because you'll be ignoring it.
2. You can choose to set the username variable to 0 and force the prompt
everytime for added security.
USAGE...
Run the script via terminal, here are some examples:
"freshen -fdE"
Refresh your files and database from a schedule backup and apply dev working
settings. Perfect for daily use.
"freshen -dEL"
Refresh your database back to the local copy, and put dev environment settings
in place. Useful after you have been experimenting locally and want to roll
back but don't need brand new data.
"freshen -dM"
Refresh your database to the current live state. This should NOT be used
pointing to a production setup, only while working on a site with a team. In
a bind this could be used to quickly replicate the site to investigate a
critical problem. NOTE: Uploaded files will not be up to date without another
tool like: http://drupal.org/project/stage_file_proxy
"freshen -c"
Refresh your working code. CAREFUL this will wipe any local changes you have
made and not PUSHED up to your remote git repo. Useful if you've messed up
your repo somehow and just want to start over code-wise.
"freshen"
This will wipe everything and completely create a fresh setup that will match
the production setup. Since this is a big deal, you'll get a confirmation.