Skip to content

Instantly share code, notes, and snippets.

@KeyboardCowboy
Last active August 5, 2016 16:44
Show Gist options
  • Save KeyboardCowboy/f4c91d5fcdfe879c44007278c89eabd7 to your computer and use it in GitHub Desktop.
Save KeyboardCowboy/f4c91d5fcdfe879c44007278c89eabd7 to your computer and use it in GitHub Desktop.
Keep selected Drupal modules out of PROD automatically with Drush.
# Create a safe space for dangerous modules.
/sites/*/modules/ignored/
/docroot/sites/*/modules/ignored/
/**
* Store dangerous contrib modules in an 'ignored' directory.
*
* See @pm_drush_pm_download_destination_alter().
*
* @param array $project
* Information about the project.
* @param array $release
* Information about the particular release version being downloaded.
*/
function quarantine_drush_pm_download_destination_alter(&$project, $release) {
$safe_place = DRUPAL_ROOT . '/sites/all/modules/ignored';
$quarantine = array(
'coder',
'coffee',
'devel',
'devel_themer',
'masquerade',
'module_filter',
);
// Alter the destination of quarantined modules.
if (in_array($project['name'], $quarantine)) {
$project['project_install_location'] = $safe_place;
}
}
@KeyboardCowboy
Copy link
Author

Know how this would work for D8 or using composer? Fork this and post the link here or post your additions in the comments and I'll update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment