Skip to content

Commit

Permalink
Add todo for v13 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
lochmueller committed Mar 20, 2024
1 parent 37fc64a commit 3afb8f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Classes/Cache/Listener/StaticCacheableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions Classes/Cache/Rule/NoNoCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
6 changes: 6 additions & 0 deletions Classes/Middleware/GenerateMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3afb8f4

Please sign in to comment.