Skip to content

Instantly share code, notes, and snippets.

@keopx
Forked from bangpound/policy.drush.inc
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keopx/db50241fc6424f347e17 to your computer and use it in GitHub Desktop.
Save keopx/db50241fc6424f347e17 to your computer and use it in GitHub Desktop.
<?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, '.prod')) {
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, '.prod')) {
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