Skip to content

Commit

Permalink
[BUGFIX] Respect date aspect in PageRepository runtime cache
Browse files Browse the repository at this point in the history
Pages with a date visibility outside the current date had their preview
link generated incorrectly as the runtime cache was already filled with
the data of the current date.

If the date aspect is taken into account proper preview links can be generated
for future or past pages as well.

Resolves: #92944
Releases: master, 10.4, 9.5
Change-Id: Icd5c1f8e1f0ddea07780d1ca1d1d050660443927
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67479
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Richard Haeser <richard@richardhaeser.com>
Reviewed-by: Richard Haeser <richard@richardhaeser.com>
  • Loading branch information
haassie committed Jan 20, 2021
1 parent aa948d6 commit 8b0e90c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion typo3/sysext/frontend/Classes/Page/PageRepository.php
Expand Up @@ -242,8 +242,11 @@ protected function init($show_hidden)
$userAspect = $this->context->getAspect('frontend.user');
$frontendUserIdentifier = 'user_' . (int)$userAspect->get('id') . '_groups_' . md5(implode(',', $userAspect->getGroupIds()));

// We need to respect the date aspect as we might have subrequests with a different time (e.g. backend preview links)
$dateTimeIdentifier = $this->context->getAspect('date')->get('timestamp');

$cache = $this->getRuntimeCache();
$cacheIdentifier = 'PageRepository_hidDelWhere' . ($show_hidden ? 'ShowHidden' : '') . '_' . (int)$this->versioningWorkspaceId . '_' . $frontendUserIdentifier;
$cacheIdentifier = 'PageRepository_hidDelWhere' . ($show_hidden ? 'ShowHidden' : '') . '_' . (int)$this->versioningWorkspaceId . '_' . $frontendUserIdentifier . '_' . $dateTimeIdentifier;
$cacheEntry = $cache->get($cacheIdentifier);
if ($cacheEntry) {
$this->where_hid_del = $cacheEntry;
Expand Down

0 comments on commit 8b0e90c

Please sign in to comment.