| @@ 23-59 (lines=37) @@ | ||
| 20 | /** |
|
| 21 | * Check Drest definitions |
|
| 22 | */ |
|
| 23 | class CheckDefinitions extends Command |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * @see Console\Command\Command |
|
| 27 | */ |
|
| 28 | protected function configure() |
|
| 29 | { |
|
| 30 | $this |
|
| 31 | ->setName('annotation:check') |
|
| 32 | ->setDescription('Checks the definitions used in Entity annotations are valid.') |
|
| 33 | ->setHelp( |
|
| 34 | <<<EOT |
|
| 35 | Validate that the drest definitions are correct |
|
| 36 | EOT |
|
| 37 | ); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @see Console\Command\Command |
|
| 42 | * |
|
| 43 | * @param InputInterface $input |
|
| 44 | * @param OutputInterface $output |
|
| 45 | * @return void |
|
| 46 | */ |
|
| 47 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 48 | { |
|
| 49 | /* @var $drm \Drest\Manager */ |
|
| 50 | $drm = $this->getHelper('drm')->getDrestManager(); |
|
| 51 | ||
| 52 | try { |
|
| 53 | $drm->checkDefinitions(); |
|
| 54 | $output->write('Syntax check OK' . PHP_EOL); |
|
| 55 | } catch (\Exception $e) { |
|
| 56 | $output->write(PHP_EOL . $e->getMessage() . PHP_EOL); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||
| @@ 23-64 (lines=42) @@ | ||
| 20 | /** |
|
| 21 | * Check Drest Production Setting |
|
| 22 | */ |
|
| 23 | class CheckProductionSettings extends Command |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * @see Console\Command\Command |
|
| 27 | */ |
|
| 28 | protected function configure() |
|
| 29 | { |
|
| 30 | $this |
|
| 31 | ->setName('config:production-ready') |
|
| 32 | ->setDescription('Checks the settings used are suitable for a production environment.') |
|
| 33 | ->setHelp( |
|
| 34 | <<<EOT |
|
| 35 | ||
| 36 | Checks the settings used are suitable for a production environment. |
|
| 37 | Notifications are given for using debug mode, or using a bad cache implementation. |
|
| 38 | ||
| 39 | Example usage: |
|
| 40 | php drest-server.php config:production-ready |
|
| 41 | EOT |
|
| 42 | ); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @see Console\Command\Command |
|
| 47 | * |
|
| 48 | * @param InputInterface $input |
|
| 49 | * @param OutputInterface $output |
|
| 50 | * @return void |
|
| 51 | */ |
|
| 52 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 53 | { |
|
| 54 | /* @var $drm \Drest\Manager */ |
|
| 55 | $drm = $this->getHelper('drm')->getDrestManager(); |
|
| 56 | ||
| 57 | try { |
|
| 58 | $drm->getConfiguration()->ensureProductionSettings(); |
|
| 59 | $output->write('Production settings OK' . PHP_EOL); |
|
| 60 | } catch (\Exception $e) { |
|
| 61 | $output->write(PHP_EOL . $e->getMessage() . PHP_EOL); |
|
| 62 | } |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||