<?php
namespace wcf\system\cache\builder;
use wcf\data\application\Application;
+use wcf\data\page\Page;
use wcf\page\CmsPage;
use wcf\system\application\ApplicationHandler;
use wcf\system\request\ControllerMap;
* @inheritDoc
*/
protected function rebuild(array $parameters) {
- return [
+ $data = [
'ciControllers' => $this->getCaseInsensitiveControllers(),
- 'customUrls' => $this->getCustomUrls(),
'landingPages' => $this->getLandingPages()
];
+
+ $data['customUrls'] = $this->getCustomUrls($data['landingPages']);
+
+ return $data;
}
/**
* 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' => []
$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']));
}
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;
+
}
}