‪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;
28 
33 {
37  protected ‪$requestHandler = RequestHandler::class;
38 
42  protected ‪$middlewareStack = 'backend';
43 
47  protected ‪$configurationManager;
48 
52  public function ‪__construct(ConfigurationManager ‪$configurationManager)
53  {
54  $this->configurationManager = ‪$configurationManager;
55  }
56 
61  protected function ‪handle(ServerRequestInterface $request): ResponseInterface
62  {
64  return $this->‪installToolRedirect();
65  }
66  // Set up the initial context
67  $this->‪initializeContext();
68  return parent::handle($request);
69  }
70 
76  protected function ‪checkIfEssentialConfigurationExists(): bool
77  {
78  return file_exists($this->configurationManager->getLocalConfigurationFileLocation())
79  && file_exists(‪Environment::getLegacyConfigPath() . '/PackageStates.php');
80  }
81 
87  protected function ‪installToolRedirect(): ResponseInterface
88  {
89  return new ‪RedirectResponse('./install.php', 302);
90  }
91 
96  protected function ‪initializeContext()
97  {
98  GeneralUtility::makeInstance(Context::class, [
99  'date' => new ‪DateTimeAspect(new \DateTimeImmutable('@' . ‪$GLOBALS['EXEC_TIME'])),
100  'visibility' => new ‪VisibilityAspect(true, true)
101  ]);
102  }
103 }
‪TYPO3\CMS\Core\Context\VisibilityAspect
Definition: VisibilityAspect.php:29
‪TYPO3\CMS\Backend\Http\Application
Definition: Application.php:33
‪TYPO3\CMS\Backend\Http
Definition: AjaxRequestHandler.php:3
‪TYPO3\CMS\Backend\Http\Application\$middlewareStack
‪string $middlewareStack
Definition: Application.php:40
‪TYPO3\CMS\Backend\Http\Application\__construct
‪__construct(ConfigurationManager $configurationManager)
Definition: Application.php:49
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:49
‪TYPO3\CMS\Core\Http\AbstractApplication
Definition: AbstractApplication.php:28
‪TYPO3\CMS\Backend\Http\Application\$requestHandler
‪string $requestHandler
Definition: Application.php:36
‪TYPO3\CMS\Backend\Http\Application\installToolRedirect
‪ResponseInterface installToolRedirect()
Definition: Application.php:84
‪TYPO3\CMS\Backend\Http\Application\checkIfEssentialConfigurationExists
‪bool checkIfEssentialConfigurationExists()
Definition: Application.php:73
‪TYPO3\CMS\Core\Http\RedirectResponse
Definition: RedirectResponse.php:27
‪TYPO3\CMS\Backend\Http\Application\$configurationManager
‪ConfigurationManager $configurationManager
Definition: Application.php:44
‪TYPO3\CMS\Backend\Http\Application\initializeContext
‪initializeContext()
Definition: Application.php:93
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:39
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Http\Application\handle
‪ResponseInterface handle(ServerRequestInterface $request)
Definition: Application.php:58
‪TYPO3\CMS\Core\Context\DateTimeAspect
Definition: DateTimeAspect.php:33
‪TYPO3\CMS\Core\Core\Environment\getLegacyConfigPath
‪static string getLegacyConfigPath()
Definition: Environment.php:256