Skip to content

Commit 3f6c79b

Browse files
weitzmanshrop
authored andcommitted
Revert "Update /drush dir for Drush9"
This reverts commit 902fa86.
1 parent e1d5d8a commit 3f6c79b

File tree

4 files changed

+38
-71
lines changed

4 files changed

+38
-71
lines changed

drush/Commands/PolicyCommands.php

-55
This file was deleted.

drush/Sites/self.site.yml

-14
This file was deleted.

drush/drush.yml

-2
This file was deleted.

drush/policy.drush.inc

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
/*
4+
* Customize this file as desired. See https://github.com/drush-ops/drush/blob/8.x/examples/policy.drush.inc for documentation.
5+
*/
6+
7+
/**
8+
* Implements drush_hook_COMMAND_validate().
9+
*
10+
* Encourage folks to use `composer` instead of Drush pm commands
11+
*/
12+
function drush_policy_pm_updatecode_validate() {
13+
return _deny_message();
14+
}
15+
16+
function drush_policy_pm_update_validate() {
17+
return _deny_message();
18+
}
19+
20+
function drush_policy_pm_download_validate() {
21+
return _deny_message();
22+
}
23+
24+
function _deny_message() {
25+
if (!drush_get_option('pm-force')) {
26+
$msg = 'This codebase is assembled with Composer instead of Drush. Use `composer update` and `composer require` instead of `drush pm-updatecode` and `drush pm-download`. You may override this error by using the --pm-force option.';
27+
return drush_set_error('POLICY_PM_DENY', dt($msg));
28+
}
29+
}
30+
31+
/**
32+
* Implements hook_drush_help_alter().
33+
*/
34+
function policy_drush_help_alter(&$command) {
35+
if (in_array($command['command'], array('pm-updatecode', 'pm-update', 'pm-download'))) {
36+
$command['options']['pm-force'] = 'Override site policy and allow Drush codebase management (pm-* commands)';
37+
}
38+
}

0 commit comments

Comments
 (0)