‪TYPO3CMS  9.5
CacheHashEnforcer.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 
21 
27 {
31  protected ‪$cacheHashCalculator;
32 
37 
44  public function ‪__construct(
47  ) {
48  $this->cacheHashCalculator = ‪$cacheHashCalculator;
49  $this->typoScriptFrontendController = ‪$typoScriptFrontendController ?: ‪$GLOBALS['TSFE'];
50  }
51 
60  public function ‪enforceForRequest(‪Request $request, string $pluginNamespace)
61  {
62  $arguments = $request->‪getArguments();
63  if (is_array($arguments) && count($arguments) > 0) {
64  $parameters = [$pluginNamespace => $arguments];
65  $parameters['id'] = $this->typoScriptFrontendController->id;
66  $relevantParameters = $this->cacheHashCalculator->getRelevantParameters(
67  http_build_query($parameters, '', '&', PHP_QUERY_RFC3986)
68  );
69  if (count($relevantParameters) > 0) {
70  $this->typoScriptFrontendController->reqCHash();
71  }
72  }
73  }
74 }
‪TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer\$cacheHashCalculator
‪CacheHashCalculator $cacheHashCalculator
Definition: CacheHashEnforcer.php:30
‪TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer
Definition: CacheHashEnforcer.php:27
‪TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer\enforceForRequest
‪enforceForRequest(Request $request, string $pluginNamespace)
Definition: CacheHashEnforcer.php:58
‪TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer\$typoScriptFrontendController
‪TypoScriptFrontendController $typoScriptFrontendController
Definition: CacheHashEnforcer.php:34
‪TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer\__construct
‪__construct(CacheHashCalculator $cacheHashCalculator, TypoScriptFrontendController $typoScriptFrontendController=null)
Definition: CacheHashEnforcer.php:42
‪TYPO3\CMS\Extbase\Mvc\Request\getArguments
‪array getArguments()
Definition: Request.php:382
‪TYPO3\CMS\Extbase\Mvc\Web\Request
Definition: Request.php:21
‪TYPO3\CMS\Extbase\Mvc\Web
Definition: AbstractRequestHandler.php:2
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition: TypoScriptFrontendController.php:97
‪TYPO3\CMS\Core\SingletonInterface
Definition: SingletonInterface.php:22
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Frontend\Page\CacheHashCalculator
Definition: CacheHashCalculator.php:24