Bug #94499 ยป 94499-redirect_without_suffix.diff
Classes/Service/SlugService.php | ||
---|---|---|
if ($this->autoUpdateSlugs || $this->autoCreateRedirects) {
|
||
$this->createCorrelationIds($pageId, $correlationId);
|
||
if ($this->autoCreateRedirects) {
|
||
$this->createRedirect($currentSlug, $defaultPageId, (int)$currentPageRecord['sys_language_uid'], (int)$pageId);
|
||
$suffix = $this->getUrlSuffixForPageType();
|
||
$this->createRedirect($currentSlug . $suffix, $defaultPageId, (int)$currentPageRecord['sys_language_uid'], (int)$pageId);
|
||
}
|
||
if ($this->autoUpdateSlugs) {
|
||
$this->checkSubPages($currentPageRecord, $currentSlug, $newSlug);
|
||
... | ... | |
protected function checkSubPages(array $currentPageRecord, string $oldSlugOfParentPage, string $newSlugOfParentPage): void
|
||
{
|
||
$suffix = $this->getUrlSuffixForPageType();
|
||
$languageUid = (int)$currentPageRecord['sys_language_uid'];
|
||
// resolveSubPages needs the page id of the default language
|
||
$pageId = $languageUid === 0 ? (int)$currentPageRecord['uid'] : (int)$currentPageRecord['l10n_parent'];
|
||
... | ... | |
$newSlug = $this->updateSlug($subPageRecord, $oldSlugOfParentPage, $newSlugOfParentPage);
|
||
if ($newSlug !== null && $this->autoCreateRedirects) {
|
||
$subPageId = (int)$subPageRecord['sys_language_uid'] === 0 ? (int)$subPageRecord['uid'] : (int)$subPageRecord['l10n_parent'];
|
||
$this->createRedirect($subPageRecord['slug'], $subPageId, $languageUid, $pageId);
|
||
$this->createRedirect($subPageRecord['slug'] . $suffix, $subPageId, $languageUid, $pageId);
|
||
}
|
||
}
|
||
}
|
||
... | ... | |
return $queryBuilder;
|
||
}
|
||
protected function getUrlSuffixForPageType(int $typeNum = 0): string
|
||
{
|
||
$suffix = '';
|
||
$siteConfiguration = $this->site->getConfiguration();
|
||
$routeEnhancers = $siteConfiguration['routeEnhancers'];
|
||
if (is_string($routeEnhancers['PageTypeSuffix']['type']) === true && $routeEnhancers['PageTypeSuffix']['type'] === 'PageType') {
|
||
if (is_string($routeEnhancers['PageTypeSuffix']['default']) === true) {
|
||
$suffix = $routeEnhancers['PageTypeSuffix']['default'];
|
||
}
|
||
if (is_array($routeEnhancers['PageTypeSuffix']['map']) === true && $key = array_search($typeNum, $routeEnhancers['PageTypeSuffix']['map'])) {
|
||
$suffix = $key;
|
||
}
|
||
if($suffix !== '' && $suffix[0] !== '.') {
|
||
$suffix .= '/' . $suffix;
|
||
}
|
||
}
|
||
return $suffix;
|
||
}
|
||
protected function enabledHook(): void
|
||
{
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['redirects'] =
|