TYPO3 CMS  TYPO3_8-7
Application.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 
24 {
28  protected $bootstrap;
29 
35  protected $entryPointLevel = 0;
36 
42  \TYPO3\CMS\Frontend\Http\RequestHandler::class,
43  \TYPO3\CMS\Frontend\Http\EidRequestHandler::class
44  ];
45 
51  public function __construct($classLoader)
52  {
53  $this->defineLegacyConstants();
54 
55  $this->bootstrap = Bootstrap::getInstance()
56  ->initializeClassLoader($classLoader)
57  ->setRequestType(TYPO3_REQUESTTYPE_FE)
58  ->baseSetup($this->entryPointLevel);
59 
60  // Redirect to install tool if base configuration is not found
61  if (!$this->bootstrap->checkIfEssentialConfigurationExists()) {
62  $this->bootstrap->redirectToInstallTool($this->entryPointLevel);
63  }
64 
65  foreach ($this->availableRequestHandlers as $requestHandler) {
66  $this->bootstrap->registerRequestHandlerImplementation($requestHandler);
67  }
68 
69  $this->bootstrap->configure();
70  }
71 
77  public function run(callable $execute = null)
78  {
79  $this->bootstrap->handleRequest(\TYPO3\CMS\Core\Http\ServerRequestFactory::fromGlobals());
80 
81  if ($execute !== null) {
82  call_user_func($execute);
83  }
84 
85  $this->bootstrap->shutdown();
86  }
87 
91  protected function defineLegacyConstants()
92  {
93  define('TYPO3_MODE', 'FE');
94  }
95 }
run(callable $execute=null)
Definition: Application.php:77