Skip to content

Commit

Permalink
Merge pull request #1 from merzilla/main
Browse files Browse the repository at this point in the history
[BUGFIX] Check TYPO3 version for RedirectCacheService usage
  • Loading branch information
georgringer authored Nov 23, 2022
2 parents 584af38 + 496f9e3 commit d6bad63
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Classes/Service/SlugService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\DataHandling\Model\CorrelationId;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\LinkHandling\LinkService;
use TYPO3\CMS\Core\Site\Entity\SiteInterface;
use TYPO3\CMS\Core\Site\SiteFinder;
Expand Down Expand Up @@ -61,7 +62,12 @@ public function rebuildSlugsForSlugChange(int $recordId, string $currentSlug, st
$redirectUid = $this->createRedirect($currentSlug, $recordId, (int)$currentRecord['sys_language_uid'], $pageId);

if ($redirectUid) {
$this->redirectCacheService->rebuildForHost($redirectUid['source_host'] ?: '*');
$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
if (version_compare((string) $typo3Version->getMajorVersion(), '11', '<')) {
$this->redirectCacheService->rebuild();
} else {
$this->redirectCacheService->rebuildForHost($redirectUid['source_host'] ?: '*');
}
return $redirectUid;
}
}
Expand Down

0 comments on commit d6bad63

Please sign in to comment.