diff --git a/Classes/Cache/Listener/StaticCacheableListener.php b/Classes/Cache/Listener/StaticCacheableListener.php index 73409911323..694890948e8 100644 --- a/Classes/Cache/Listener/StaticCacheableListener.php +++ b/Classes/Cache/Listener/StaticCacheableListener.php @@ -24,8 +24,10 @@ public function __invoke(CacheRuleEvent $event): void { if (($GLOBALS['TSFE'] ?? null) instanceof TypoScriptFrontendController) { if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() >= 13) { + /* @phpstan-ignore-next-line */ $isStaticCacheble = $GLOBALS['TSFE']->isStaticCacheble($event->getRequest()); } else { + /* @phpstan-ignore-next-line */ $isStaticCacheble = $GLOBALS['TSFE']->isStaticCacheble(); } if(!$isStaticCacheble) { diff --git a/Classes/Cache/Rule/NoNoCache.php b/Classes/Cache/Rule/NoNoCache.php index 8349338a737..9665d526f0d 100644 --- a/Classes/Cache/Rule/NoNoCache.php +++ b/Classes/Cache/Rule/NoNoCache.php @@ -18,6 +18,7 @@ class NoNoCache extends AbstractRule public function checkRule(ServerRequestInterface $request, array &$explanation, bool &$skipProcessing): void { $tsfe = $GLOBALS['TSFE'] ?? null; + /* @phpstan-ignore-next-line */ if ($tsfe instanceof TypoScriptFrontendController && $tsfe->no_cache) { $explanation[__CLASS__] = 'config.no_cache is true'; } diff --git a/Classes/Middleware/GenerateMiddleware.php b/Classes/Middleware/GenerateMiddleware.php index 69e8027c31b..9c7cbf1228e 100644 --- a/Classes/Middleware/GenerateMiddleware.php +++ b/Classes/Middleware/GenerateMiddleware.php @@ -18,6 +18,8 @@ use SFC\Staticfilecache\Service\DateTimeService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; +use TYPO3\CMS\Frontend\Event\AfterCachedPageIsPersistedEvent; +use TYPO3\CMS\Frontend\Event\ModifyCacheLifetimeForPageEvent; class GenerateMiddleware implements MiddlewareInterface { @@ -82,6 +84,10 @@ protected function calculateLifetime(TypoScriptFrontendController $tsfe): int // $this->logger->warning('TSFE to not contains a valid page record?! Please check: https://github.com/lochmueller/staticfilecache/issues/150'); return 0; } + + // @todo migrate for v13 to Events + // Check ModifyCacheLifetimeForPageEvent & AfterCachedPageIsPersistedEvent + $timeOutTime = $tsfe->get_cache_timeout(); // If page has a endtime before the current timeOutTime, use it instead: