Skip to content

Instantly share code, notes, and snippets.

@bfodeke
Forked from shrop/policy.drush.inc
Created December 20, 2016 19:08
Show Gist options
  • Save bfodeke/0d023dbad617da513ca33d4622dbf761 to your computer and use it in GitHub Desktop.
Save bfodeke/0d023dbad617da513ca33d4622dbf761 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