‪TYPO3CMS  9.5
Application.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 Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
20 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
30 
35 {
39  protected ‪$requestHandler = RequestHandler::class;
40 
44  protected ‪$middlewareStack = 'frontend';
45 
49  protected ‪$configurationManager;
50 
54  public function ‪__construct(ConfigurationManager ‪$configurationManager)
55  {
56  $this->configurationManager = ‪$configurationManager;
57  }
58 
63  protected function ‪handle(ServerRequestInterface $request): ResponseInterface
64  {
66  return $this->‪installToolRedirect();
67  }
68  $this->‪initializeContext();
69  return parent::handle($request);
70  }
71 
77  protected function ‪checkIfEssentialConfigurationExists(): bool
78  {
79  return file_exists($this->configurationManager->getLocalConfigurationFileLocation())
80  && file_exists(‪Environment::getLegacyConfigPath() . '/PackageStates.php');
81  }
82 
88  protected function ‪installToolRedirect(): ResponseInterface
89  {
90  $path = TYPO3_mainDir . 'install.php';
91  return new ‪RedirectResponse($path, 302);
92  }
93 
98  protected function ‪initializeContext()
99  {
100  GeneralUtility::makeInstance(Context::class, [
101  'date' => new ‪DateTimeAspect(new \DateTimeImmutable('@' . ‪$GLOBALS['EXEC_TIME'])),
102  'visibility' => new ‪VisibilityAspect(),
103  'workspace' => new ‪WorkspaceAspect(0),
104  'backend.user' => new ‪UserAspect(null),
105  'frontend.user' => new ‪UserAspect(null, [0, -1]),
106  ]);
107  }
108 }
‪TYPO3\CMS\Core\Context\VisibilityAspect
Definition: VisibilityAspect.php:29
‪TYPO3\CMS\Core\Context\WorkspaceAspect
Definition: WorkspaceAspect.php:29
‪TYPO3\CMS\Frontend\Http
Definition: Application.php:3
‪TYPO3\CMS\Frontend\Http\Application\installToolRedirect
‪ResponseInterface installToolRedirect()
Definition: Application.php:85
‪TYPO3\CMS\Frontend\Http\Application\$requestHandler
‪string $requestHandler
Definition: Application.php:38
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:49
‪TYPO3\CMS\Core\Http\AbstractApplication
Definition: AbstractApplication.php:28
‪TYPO3\CMS\Frontend\Http\Application\checkIfEssentialConfigurationExists
‪bool checkIfEssentialConfigurationExists()
Definition: Application.php:74
‪TYPO3\CMS\Frontend\Http\Application\handle
‪ResponseInterface handle(ServerRequestInterface $request)
Definition: Application.php:60
‪TYPO3\CMS\Core\Http\RedirectResponse
Definition: RedirectResponse.php:27
‪TYPO3\CMS\Frontend\Http\Application\initializeContext
‪initializeContext()
Definition: Application.php:95
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:39
‪TYPO3\CMS\Frontend\Http\Application\$configurationManager
‪ConfigurationManager $configurationManager
Definition: Application.php:46
‪TYPO3\CMS\Frontend\Http\Application\$middlewareStack
‪string $middlewareStack
Definition: Application.php:42
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Frontend\Http\Application
Definition: Application.php:35
‪TYPO3\CMS\Frontend\Http\Application\__construct
‪__construct(ConfigurationManager $configurationManager)
Definition: Application.php:51
‪TYPO3\CMS\Core\Context\DateTimeAspect
Definition: DateTimeAspect.php:33
‪TYPO3\CMS\Core\Core\Environment\getLegacyConfigPath
‪static string getLegacyConfigPath()
Definition: Environment.php:256
‪TYPO3\CMS\Core\Context\UserAspect
Definition: UserAspect.php:36