Skip to content

Instantly share code, notes, and snippets.

@shrop
Created April 8, 2016 15:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save shrop/73cc743686c370fcf1beebe959ea947d to your computer and use it in GitHub Desktop.
Save shrop/73cc743686c370fcf1beebe959ea947d to your computer and use it in GitHub Desktop.
Sample Drush policy file
<?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