1 <?php
2
3 use Symfony\Component\Console\Application;
4 use Symfony\Component\Console\Command\Command;
5 use Symfony\Component\Console\Input\InputInterface;
6 use Symfony\Component\Console\Output\OutputInterface;
7 use Symfony\Component\Debug\Exception\FatalThrowableError;
8
9 10 11
12 class rex_console_application extends Application
13 {
14 public function __construct()
15 {
16 parent::__construct('REDAXO', rex::getVersion());
17 }
18
19 public function doRun(InputInterface $input, OutputInterface $output)
20 {
21 try {
22 return parent::doRun($input, $output);
23 } catch (\Exception $e) {
24
25 throw $e;
26 } catch (\Throwable $e) {
27 throw new FatalThrowableError($e);
28 }
29 }
30
31 protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
32 {
33 if ($command instanceof rex_console_command) {
34 $this->loadPackages($command);
35 }
36
37 return parent::doRunCommand($command, $input, $output);
38 }
39
40 private function loadPackages(rex_console_command $command)
41 {
42 if ('ydeploy:migrate' === $command->getName()) {
43 $command->getPackage()->boot();
44
45 return;
46 }
47
48 if (!rex::isSetup()) {
49 foreach (rex::getConfig('package-order') as $packageId) {
50 rex_package::get($packageId)->boot();
51 }
52 }
53
54 rex_extension::registerPoint(new rex_extension_point('PACKAGES_INCLUDED'));
55 }
56 }
57