TYPO3 CMS  TYPO3_7-6
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 
34  protected $entryPointPath = '';
35 
41  \TYPO3\CMS\Frontend\Http\RequestHandler::class,
42  \TYPO3\CMS\Frontend\Http\EidRequestHandler::class
43  ];
44 
50  public function __construct($classLoader)
51  {
52  $this->defineLegacyConstants();
53 
54  $this->bootstrap = Bootstrap::getInstance()
55  ->initializeClassLoader($classLoader)
56  ->baseSetup($this->entryPointPath);
57 
58  // Redirect to install tool if base configuration is not found
59  if (!$this->bootstrap->checkIfEssentialConfigurationExists()) {
60  $this->bootstrap->redirectToInstallTool($this->entryPointPath);
61  }
62 
63  foreach ($this->availableRequestHandlers as $requestHandler) {
64  $this->bootstrap->registerRequestHandlerImplementation($requestHandler);
65  }
66 
67  $this->bootstrap->configure();
68  }
69 
76  public function run(callable $execute = null)
77  {
78  $this->bootstrap->handleRequest(\TYPO3\CMS\Core\Http\ServerRequestFactory::fromGlobals());
79 
80  if ($execute !== null) {
81  call_user_func($execute);
82  }
83 
84  $this->bootstrap->shutdown();
85  }
86 
90  protected function defineLegacyConstants()
91  {
92  define('TYPO3_MODE', 'FE');
93  }
94 }
run(callable $execute=null)
Definition: Application.php:76