Showing
1 changed file
with
0 additions
and
39 deletions
drush/Commands/PolicyCommands.php
deleted
100644 → 0
| 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