Created
November 6, 2012 12:36
-
-
Save sirkitree/4024377 to your computer and use it in GitHub Desktop.
Don't allow yourself to screw up with sql-sync to the production environment.
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 | |
$options['shell-aliases']['syncdb'] = '!drush --verbose --yes sql-sync --create-db @pac12.prod @self'; |
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 | |
/** | |
* @file | |
* Policy commandfile. | |
* | |
* Validates commands as they are issued and returns an error | |
* or changes options when policy is violated. | |
*/ | |
/** | |
* Implement of drush_hook_COMMAND_validate(). | |
* | |
* Prevent catastrophic braino when syncing databases. | |
*/ | |
function drush_policy_sql_sync_validate($source = NULL, $destination = NULL) { | |
if ($destination == '@pac12.prod') { | |
return drush_set_error(dt('You may never overwrite the production database.')); | |
} | |
} | |
/** | |
* Implement of drush_hook_COMMAND_validate(). | |
* | |
* Prevent catastrophic braino when rsyncing files. | |
*/ | |
function drush_policy_core_rsync_validate($source = NULL, $destination = NULL) { | |
if (preg_match('/^@pac12.prod/', $destination)) { | |
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