Skip to content

Commit 3de87eb

Browse files
committed
Restored drush folder
1 parent f8d619c commit 3de87eb

4 files changed

Lines changed: 50 additions & 0 deletions

File tree

.markdownlintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ web/*.md
1010
web/core/
1111
web/libraries/
1212
web/*/contrib/
13+
14+
# Drupal specific
15+
drush

drush/Commands/PolicyCommands.php

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

drush/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This directory contains commands, configuration and site aliases for Drush. See https://packagist.org/search/?type=drupal-drush for a directory of Drush commands installable via Composer.

drush/drush.yml

Lines changed: 6 additions & 0 deletions
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.

0 commit comments

Comments
 (0)