‪TYPO3CMS  10.4
FrontendRequestHandler.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 
26 {
30  protected ‪$configurationManager;
31 
36  {
37  $this->configurationManager = ‪$configurationManager;
38  }
39 
45  public function ‪handleRequest()
46  {
47  $request = $this->requestBuilder->build();
48  if ($this->‪isActionCacheable($request->getControllerObjectName(), $request->getControllerActionName())) {
49  $request->setIsCached(true);
50  } else {
51  $contentObject = $this->configurationManager->getContentObject();
52  if ($contentObject->getUserObjectType() === ‪ContentObjectRenderer::OBJECTTYPE_USER) {
53  $contentObject->convertToUserIntObject();
54  // \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::convertToUserIntObject() will recreate the object, so we have to stop the request here
55  return null;
56  }
57  $request->setIsCached(false);
58  }
59 
60  if ($this->configurationManager->isFeatureEnabled('requireCHashArgumentForActionArguments')) {
61  trigger_error('The option requireCHashArgumentForActionArguments is removed', E_USER_DEPRECATED);
62  }
63 
65  $response = $this->objectManager->get(Response::class);
66  $this->dispatcher->dispatch($request, $response);
67  return $response;
68  }
69 
75  public function ‪canHandleRequest()
76  {
77  return $this->environmentService->isEnvironmentInFrontendMode();
78  }
79 
80  protected function ‪isActionCacheable(string $controllerClassName, string $actionName): bool
81  {
82  $frameworkConfiguration = $this->configurationManager->getConfiguration(
84  );
85 
86  $nonCacheableActions = $frameworkConfiguration['controllerConfiguration'][$controllerClassName]['nonCacheableActions'] ?? null;
87 
88  if (!is_array($nonCacheableActions)) {
89  return true;
90  }
91 
92  return !in_array($actionName, $frameworkConfiguration['controllerConfiguration'][$controllerClassName]['nonCacheableActions'], true);
93  }
94 }
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\handleRequest
‪TYPO3 CMS Extbase Mvc ResponseInterface null handleRequest()
Definition: FrontendRequestHandler.php:44
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\OBJECTTYPE_USER
‪const OBJECTTYPE_USER
Definition: ContentObjectRenderer.php:436
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\$configurationManager
‪ConfigurationManagerInterface $configurationManager
Definition: FrontendRequestHandler.php:29
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\canHandleRequest
‪bool canHandleRequest()
Definition: FrontendRequestHandler.php:74
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:28
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface\CONFIGURATION_TYPE_FRAMEWORK
‪const CONFIGURATION_TYPE_FRAMEWORK
Definition: ConfigurationManagerInterface.php:29
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\isActionCacheable
‪isActionCacheable(string $controllerClassName, string $actionName)
Definition: FrontendRequestHandler.php:79
‪TYPO3\CMS\Extbase\Mvc\Web\AbstractRequestHandler
Definition: AbstractRequestHandler.php:28
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\injectConfigurationManager
‪injectConfigurationManager(ConfigurationManagerInterface $configurationManager)
Definition: FrontendRequestHandler.php:34
‪TYPO3\CMS\Extbase\Mvc\Web
Definition: AbstractRequestHandler.php:16
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler
Definition: FrontendRequestHandler.php:26
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:97