-
Notifications
You must be signed in to change notification settings - Fork 941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update /drush dir for Drush9 #350
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
namespace Drush\Commands; | ||
|
||
use Consolidation\AnnotatedCommand\CommandData; | ||
use Drush\Commands\DrushCommands; | ||
use Symfony\Component\Console\Input\InputOption; | ||
|
||
/** | ||
* Edit this file to reflect your organization's needs. | ||
*/ | ||
|
||
class PolicyCommands extends DrushCommands { | ||
|
||
/** | ||
* Prevent catastrophic braino. Note that this file has to be local to the | ||
* machine that initiates the sql:sync command. | ||
* | ||
* hook validate sql:sync | ||
* | ||
* @throws \Exception | ||
*/ | ||
public function sqlSyncValidate(CommandData $commandData) { | ||
if ($commandData->input()->getArgument('destination') == '@prod') { | ||
throw new \Exception(dt('Per !file, you may never overwrite the production database.', ['!file' => __FILE__])); | ||
} | ||
} | ||
|
||
/** | ||
* Limit rsync operations to production site. | ||
* | ||
* hook validate core:rsync | ||
*/ | ||
public function rsyncValidate(CommandData $commandData) { | ||
if (preg_match("/^@prod/", $commandData->input()->getArgument('destination'))) { | ||
throw new \Exception(dt('Per !file, you may never rsync to the production site.', ['!file' => __FILE__])); | ||
} | ||
} | ||
|
||
/** | ||
* Unauthorized may not execute updates. | ||
* | ||
* @hook validate updatedb | ||
*/ | ||
public function validateUpdateDb(CommandData $commandData) { | ||
if (!$commandData->input()->getOption('secret') == 'mysecret') { | ||
throw new \Exception(dt('UpdateDb command requires a secret token per site policy.')); | ||
} | ||
} | ||
|
||
/** | ||
* @hook option updatedb | ||
* @option secret A required token else user may not run updatedb command. | ||
*/ | ||
public function optionsetUpdateDb($options = ['secret' => self::REQ]) {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Edit or remove this file as needed. | ||
# Docs at https://github.com/drush-ops/drush/blob/master/examples/example.site.yml | ||
|
||
#live: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets use prod here. It should match with our default policy file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. drush/Sites/self.site.yml should be sites?. I looked through the drush code and should not find a instance with |
||
# host: live.domain.com | ||
# user: www-admin | ||
# root: /path/to/drupal | ||
# uri: http://www.example.com | ||
# | ||
#stage: | ||
# host: stage.domain.com | ||
# user: www-admin | ||
# root: /path/to/drupal | ||
# uri: http://stage.example.com |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# A Drush configuration file. | ||
# Details at https://github.com/drush-ops/drush/blob/master/examples/example.drush.yml |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets remove the validateUpdateDb example. I think its to advanced. We could like to the example for more examples :) sqlSyncValidate and rsyncValidate is good enough.