Commit 3a5ed8230797489aca17cf0936f12bb8a2247061

Authored by 王子强
1 parent 4668e22b

rm drush

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('target') == '@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('target'))) {
36   - throw new \Exception(dt('Per !file, you may never rsync to the production site.', ['!file' => __FILE__]));
37   - }
38   - }
39   -}
Please register or login to post a comment