From: Alexander Ebert Date: Thu, 15 Dec 2016 02:47:08 +0000 (+0100) Subject: Fixed i18n cms page used as core's landing page X-Git-Tag: 3.0.0_RC_1~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7eab60e7559e25a3095555dffc748436fb12eb9a;p=GitHub%2FWoltLab%2FWCF.git Fixed i18n cms page used as core's landing page --- diff --git a/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php index 360f5d9859..758e713762 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php @@ -1,6 +1,7 @@ $this->getCaseInsensitiveControllers(), - 'customUrls' => $this->getCustomUrls(), 'landingPages' => $this->getLandingPages() ]; + + $data['customUrls'] = $this->getCustomUrls($data['landingPages']); + + return $data; } /** @@ -127,9 +131,10 @@ class RoutingCacheBuilder extends AbstractCacheBuilder { * Builds up a lookup and a reverse lookup list per application in order to resolve * custom page mappings. * + * @param array $landingPages * @return array */ - protected function getCustomUrls() { + protected function getCustomUrls(array $landingPages) { $data = [ 'lookup' => [], 'reverse' => [] @@ -159,6 +164,11 @@ class RoutingCacheBuilder extends AbstractCacheBuilder { $rows[] = $row; } + $cmsPageID = 0; + if (preg_match('~^__WCF_CMS__(\d+)$~', $landingPages['wcf'][0], $matches)) { + $cmsPageID = $matches[1]; + } + $abbreviations = []; foreach ($rows as $row) { $customUrl = FileUtil::removeLeadingSlash(FileUtil::removeTrailingSlash($row['controllerCustomURL'])); @@ -178,8 +188,17 @@ class RoutingCacheBuilder extends AbstractCacheBuilder { } else { $cmsIdentifier = '__WCF_CMS__' . $row['pageID'] . '-' . ($row['languageID'] ?: 0); - $data['lookup'][$abbreviations[$packageID]][$customUrl] = $cmsIdentifier; + $data['reverse'][$abbreviations[$packageID]][$cmsIdentifier] = $customUrl; + + if ($cmsPageID && $abbreviations[$packageID] === 'wcf') { + if ($customUrl === '' && $cmsPageID != $row['pageID']) { + continue; + } + } + + $data['lookup'][$abbreviations[$packageID]][$customUrl] = $cmsIdentifier; + } }