Merge pull request #4830 from WoltLab/landingPage
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 27 May 2022 14:17:59 +0000 (16:17 +0200)
committerGitHub <noreply@github.com>
Fri, 27 May 2022 14:17:59 +0000 (16:17 +0200)
Remove magic numbers from RoutingCacheBuilder's landingPages data

1  2 
wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php
wcfsetup/install/files/lib/system/request/ControllerMap.class.php

index ce72cfd50c7444b5fc2370e52e6aeee0bda693e0,4d456439119a1fc875a84124de799ac5c2f08552..9a0097d0668385163465f8a47b7d70c0fd615cb2
@@@ -249,15 -249,17 +249,15 @@@ class ControllerMap extends SingletonFa
       * Lookups default controller for given application.
       *
       * @param string $application application identifier
 -     * @return  null|string[]   default controller
 +     * @return  string[]   default controller
       * @throws  SystemException
       */
 -    public function lookupDefaultController($application)
 +    public function lookupDefaultController($application): array
      {
          $data = $this->landingPages[$application];
-         $controller = $data[1];
+         $controller = $data['routePart'];
  
 -        if ($application === 'wcf' && empty($controller)) {
 -            return null;
 -        } elseif (\preg_match('~^__WCF_CMS__(?P<pageID>\d+)$~', $controller, $matches)) {
 +        if (\preg_match('~^__WCF_CMS__(?P<pageID>\d+)$~', $controller, $matches)) {
              $cmsPageData = $this->lookupCmsPage($matches['pageID'], 0);
              if ($cmsPageData === null) {
                  // page is multilingual, use the language id that matches the URL