‪TYPO3CMS  10.4
Application.php
Go to the documentation of this file.
1 <?php
2 
3 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 
19 
20 use Psr\Http\Message\ResponseInterface;
21 use Psr\Http\Message\ServerRequestInterface;
22 use Psr\Http\Server\RequestHandlerInterface;
23 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
31 
36 {
40  protected ‪$configurationManager;
41 
45  protected ‪$context;
46 
47  public function ‪__construct(
48  RequestHandlerInterface ‪$requestHandler,
49  ConfigurationManager ‪$configurationManager,
51  ) {
52  $this->requestHandler = ‪$requestHandler;
53  $this->configurationManager = ‪$configurationManager;
54  $this->context = ‪$context;
55  }
56 
57  protected function ‪handle(ServerRequestInterface $request): ResponseInterface
58  {
60  return $this->‪installToolRedirect();
61  }
62 
63  // Add applicationType attribute to request: This is backend and maybe backend ajax.
65  if (strpos($request->getQueryParams()['route'] ?? '', '/ajax/') === 0) {
67  }
68  $request = $request->withAttribute('applicationType', $applicationType);
69 
70  // Set up the initial context
71  $this->‪initializeContext();
72  return parent::handle($request);
73  }
74 
80  protected function ‪checkIfEssentialConfigurationExists(): bool
81  {
82  return file_exists($this->configurationManager->getLocalConfigurationFileLocation())
83  && file_exists(‪Environment::getLegacyConfigPath() . '/PackageStates.php');
84  }
85 
91  protected function ‪installToolRedirect(): ResponseInterface
92  {
93  return new RedirectResponse('./install.php', 302);
94  }
95 
99  protected function ‪initializeContext(): void
100  {
101  $this->context->setAspect('date', new DateTimeAspect(new \DateTimeImmutable('@' . ‪$GLOBALS['EXEC_TIME'])));
102  $this->context->setAspect('visibility', new VisibilityAspect(true, true));
103  }
104 }
‪TYPO3\CMS\Backend\Http\Application\handle
‪handle(ServerRequestInterface $request)
Definition: Application.php:55
‪TYPO3\CMS\Core\Context\VisibilityAspect
Definition: VisibilityAspect.php:31
‪TYPO3\CMS\Backend\Http\Application
Definition: Application.php:36
‪TYPO3\CMS\Backend\Http
Definition: Application.php:18
‪TYPO3\CMS\Core\Core\SystemEnvironmentBuilder
Definition: SystemEnvironmentBuilder.php:42
‪TYPO3\CMS\Core\Core\SystemEnvironmentBuilder\REQUESTTYPE_BE
‪const REQUESTTYPE_BE
Definition: SystemEnvironmentBuilder.php:46
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:53
‪TYPO3\CMS\Core\Http\AbstractApplication
Definition: AbstractApplication.php:29
‪TYPO3\CMS\Backend\Http\Application\__construct
‪__construct(RequestHandlerInterface $requestHandler, ConfigurationManager $configurationManager, Context $context)
Definition: Application.php:45
‪TYPO3\CMS\Backend\Http\Application\installToolRedirect
‪ResponseInterface installToolRedirect()
Definition: Application.php:89
‪TYPO3\CMS\Backend\Http\Application\checkIfEssentialConfigurationExists
‪bool checkIfEssentialConfigurationExists()
Definition: Application.php:78
‪TYPO3\CMS\Core\Http\RedirectResponse
Definition: RedirectResponse.php:28
‪TYPO3\CMS\Backend\Http\Application\$configurationManager
‪ConfigurationManager $configurationManager
Definition: Application.php:39
‪TYPO3\CMS\Core\Http\AbstractApplication\$requestHandler
‪RequestHandlerInterface null $requestHandler
Definition: AbstractApplication.php:36
‪TYPO3\CMS\Backend\Http\Application\initializeContext
‪initializeContext()
Definition: Application.php:97
‪TYPO3\CMS\Core\Core\SystemEnvironmentBuilder\REQUESTTYPE_AJAX
‪const REQUESTTYPE_AJAX
Definition: SystemEnvironmentBuilder.php:50
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:40
‪TYPO3\CMS\Backend\Http\Application\$context
‪Context $context
Definition: Application.php:43
‪TYPO3\CMS\Core\Context\DateTimeAspect
Definition: DateTimeAspect.php:35
‪TYPO3\CMS\Core\Core\Environment\getLegacyConfigPath
‪static string getLegacyConfigPath()
Definition: Environment.php:282