From: Tim Düsterhus Date: Wed, 1 Jun 2022 13:05:08 +0000 (+0200) Subject: Simplify RoutingCacheBuilder::getLandingPage() X-Git-Tag: 6.0.0_Alpha_1~1219^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=471de6c1320de8882c133fa0a192266333afe1a3;p=GitHub%2FWoltLab%2FWCF.git Simplify RoutingCacheBuilder::getLandingPage() Reduce the amount of special handling required for the 'wcf' app. --- 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 3d99aded67..e05ca45378 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php @@ -4,6 +4,7 @@ namespace wcf\system\cache\builder; use wcf\data\application\Application; use wcf\data\page\PageCache; +use wcf\page\ArticleListPage; use wcf\page\CmsPage; use wcf\system\application\ApplicationHandler; use wcf\system\language\LanguageFactory; @@ -343,37 +344,26 @@ class RoutingCacheBuilder extends AbstractCacheBuilder $controller = null; - if ($application->packageID == 1) { - // handle WCF - $page = PageCacheBuilder::getInstance()->getData([], 'landingPage'); - if ($page->controller) { - $controller = $page->controller; - } else { - $controller = '__WCF_CMS__' . $page->pageID; - $controller = [ - 'controller' => $controller, - 'routePart' => $controller, - 'className' => CmsPage::class, - ]; - } - } else { - if ($application->landingPageID) { - $page = PageCache::getInstance()->getPage($application->landingPageID); - if ($page !== null) { - if ($page->controller) { - $controller = $page->controller; - } else { - $controller = '__WCF_CMS__' . $page->pageID; - $controller = [ - 'controller' => $controller, - 'routePart' => $controller, - 'className' => CmsPage::class, - ]; - } + if ($application->landingPageID) { + $page = PageCache::getInstance()->getPage($application->landingPageID); + if ($page !== null) { + if ($page->controller) { + $controller = $page->controller; + } else { + $controller = '__WCF_CMS__' . $page->pageID; + $controller = [ + 'controller' => $controller, + 'routePart' => $controller, + 'className' => CmsPage::class, + ]; } } + } - if ($controller === null) { + if ($controller === null) { + if ($application->getAbbreviation() === 'wcf') { + $controller = ArticleListPage::class; + } else { $controller = WCF::getApplicationObject($application)->getPrimaryController(); } }