Skip to content

Instantly share code, notes, and snippets.

@teknikqa
Forked from shrop/policy.drush.inc
Created April 11, 2016 07:14
Show Gist options
  • Save teknikqa/9f89c13eef31cefc90c9f6d55c69d1d0 to your computer and use it in GitHub Desktop.
Save teknikqa/9f89c13eef31cefc90c9f6d55c69d1d0 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