‪TYPO3CMS  9.5
CommandRequestHandler.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 use Symfony\Component\Console\Application;
19 use Symfony\Component\Console\Command\Command;
20 use Symfony\Component\Console\Input\InputInterface;
21 use Symfony\Component\Console\Output\ConsoleOutput;
25 
30 {
35  protected ‪$application;
36 
40  public function ‪__construct()
41  {
42  $this->application = new Application('TYPO3 CMS', TYPO3_version);
43  }
44 
50  public function ‪handleRequest(InputInterface $input)
51  {
52  ‪$output = new ConsoleOutput();
53 
55  // create the BE_USER object (not logged in yet)
56  ‪Bootstrap::initializeBackendUser(CommandLineUserAuthentication::class);
58  // Make sure output is not buffered, so command-line output and interaction can take place
59  ob_clean();
60 
62 
63  $exitCode = $this->application->run($input, ‪$output);
64  exit($exitCode);
65  }
66 
73  public function ‪canHandleRequest(InputInterface $input): bool
74  {
75  return true;
76  }
77 
83  public function ‪getPriority(): int
84  {
85  return 50;
86  }
87 
92  protected function ‪populateAvailableCommands()
93  {
94  $commands = GeneralUtility::makeInstance(CommandRegistry::class);
95 
96  foreach ($commands as $commandName => $command) {
98  $this->application->add($command);
99  }
100  }
101 }
‪TYPO3\CMS\Core\Console\CommandRequestHandler\getPriority
‪int getPriority()
Definition: CommandRequestHandler.php:82
‪TYPO3\CMS\Core\Console\CommandRequestHandler
Definition: CommandRequestHandler.php:30
‪TYPO3\CMS\Core\Console\CommandRequestHandler\handleRequest
‪handleRequest(InputInterface $input)
Definition: CommandRequestHandler.php:49
‪TYPO3\CMS\Core\Console\CommandRequestHandler\__construct
‪__construct()
Definition: CommandRequestHandler.php:39
‪TYPO3\CMS\Core\Console
Definition: CommandApplication.php:2
‪TYPO3\CMS\Core\Core\Bootstrap\initializeBackendUser
‪static Bootstrap null initializeBackendUser($className=\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class)
Definition: Bootstrap.php:956
‪TYPO3\CMS\Core\Console\CommandRequestHandler\canHandleRequest
‪bool canHandleRequest(InputInterface $input)
Definition: CommandRequestHandler.php:72
‪TYPO3\CMS\Core\Console\RequestHandlerInterface
Definition: RequestHandlerInterface.php:24
‪TYPO3\CMS\Core\Console\CommandRequestHandler\$application
‪Application $application
Definition: CommandRequestHandler.php:34
‪TYPO3\CMS\Core\Core\Bootstrap\loadExtTables
‪static Bootstrap null loadExtTables(bool $allowCaching=true)
Definition: Bootstrap.php:864
‪$output
‪$output
Definition: annotationChecker.php:113
‪TYPO3\CMS\Core\Core\Bootstrap
Definition: Bootstrap.php:50
‪TYPO3\CMS\Core\Console\CommandRequestHandler\populateAvailableCommands
‪populateAvailableCommands()
Definition: CommandRequestHandler.php:91
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Authentication\CommandLineUserAuthentication
Definition: CommandLineUserAuthentication.php:29
‪TYPO3\CMS\Core\Core\Bootstrap\initializeLanguageObject
‪static Bootstrap null initializeLanguageObject()
Definition: Bootstrap.php:986