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]) { } }