Created
April 8, 2016 15:51
-
-
Save shrop/73cc743686c370fcf1beebe959ea947d to your computer and use it in GitHub Desktop.
Sample Drush policy file
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 | |
* Drush policies to restrict what is allowed for certain drush commands. | |
*/ | |
/** | |
* Prevent production databases from being overwritten using drush sql-sync. | |
*/ | |
function drush_policy_sql_sync_validate($source = NULL, $destination = NULL) { | |
if (strpos($destination, 'prod') !== FALSE) { | |
return drush_set_error('POLICY_DENY', dt('You cannot overwrite a production database.')); | |
} | |
} | |
/** | |
* Prevent production files from being overwritten using drush core-rsync. | |
*/ | |
function drush_policy_core_rsync_validate($source = NULL, $destination = NULL) { | |
if (strpos($destination, 'prod') !== FALSE) { | |
return drush_set_error('POLICY_DENY', dt('You cannot rsync to a production site.')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment