Created
May 30, 2012 20:41
-
-
Save bangpound/2838819 to your computer and use it in GitHub Desktop.
Drush policy file to prevent catastrophes on live environments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implement of drush_hook_COMMAND_validate(). | |
* | |
* Prevent catastrophic sql-sync to live. Note that this file has to be local to the | |
* machine that intitiates sql-sync command. | |
*/ | |
function drush_policy_sql_sync_validate($source = NULL, $destination = NULL) { | |
if (strstr($destination, '.live')) { | |
return drush_set_error(dt('You may never overwrite the production database.')); | |
} | |
} | |
/** | |
* Implement of drush_hook_COMMAND_validate(). | |
* | |
* Prevent catastrophic rsync to live. Note that this file has to be local to the machine | |
* that intitiates sql-sync command. | |
*/ | |
function drush_policy_core_rsync_validate($source = NULL, $destination = NULL) { | |
if (strstr($destination, '.live')) { | |
return drush_set_error(dt('You may never overwrite the production files.')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment