Skip to content

Commit 3f5e7f4

Browse files
weitzmanshrop
authored andcommitted
Update /drush dir for Drush9 (drupal-composer#350)
1 parent 3f6c79b commit 3f5e7f4

File tree

4 files changed

+59
-38
lines changed

4 files changed

+59
-38
lines changed

drush/Commands/PolicyCommands.php

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Drush\Commands;
4+
5+
use Consolidation\AnnotatedCommand\CommandData;
6+
use Drush\Commands\DrushCommands;
7+
8+
/**
9+
* Edit this file to reflect your organization's needs.
10+
*/
11+
class PolicyCommands extends DrushCommands {
12+
13+
/**
14+
* Prevent catastrophic braino. Note that this file has to be local to the
15+
* machine that initiates the sql:sync command.
16+
*
17+
* @hook validate sql:sync
18+
*
19+
* @throws \Exception
20+
*/
21+
public function sqlSyncValidate(CommandData $commandData) {
22+
if ($commandData->input()->getArgument('destination') == '@prod') {
23+
throw new \Exception(dt('Per !file, you may never overwrite the production database.', ['!file' => __FILE__]));
24+
}
25+
}
26+
27+
/**
28+
* Limit rsync operations to production site.
29+
*
30+
* @hook validate core:rsync
31+
*
32+
* @throws \Exception
33+
*/
34+
public function rsyncValidate(CommandData $commandData) {
35+
if (preg_match("/^@prod/", $commandData->input()->getArgument('destination'))) {
36+
throw new \Exception(dt('Per !file, you may never rsync to the production site.', ['!file' => __FILE__]));
37+
}
38+
}
39+
}

drush/drush.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# A Drush configuration file
3+
#
4+
# Docs at https://github.com/drush-ops/drush/blob/master/examples/example.drush.yml
5+
#
6+
# Edit or remove this file as needed.

drush/policy.drush.inc

-38
This file was deleted.

drush/sites/self.site.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Edit or remove this file as needed.
2+
# Docs at https://github.com/drush-ops/drush/blob/master/examples/example.site.yml
3+
4+
#prod:
5+
# host: prod.domain.com
6+
# user: www-admin
7+
# root: /path/to/drupal
8+
# uri: http://www.example.com
9+
#
10+
#stage:
11+
# host: stage.domain.com
12+
# user: www-admin
13+
# root: /path/to/drupal
14+
# uri: http://stage.example.com

0 commit comments

Comments
 (0)