From: Tim Düsterhus Date: Thu, 2 Jun 2022 10:42:36 +0000 (+0200) Subject: Remove reverse lookup for RoutingCacheBuilder::getCaseInsensitiveControllers() X-Git-Tag: 6.0.0_Alpha_1~1212^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c4085748033b639c5fe8a3502ed279eb9fc6cfbf;p=GitHub%2FWoltLab%2FWCF.git Remove reverse lookup for RoutingCacheBuilder::getCaseInsensitiveControllers() This reverse lookup is not used, drop it to simplify the logic. --- 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 d2a219ab4c..fa8b25bc31 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php @@ -130,10 +130,7 @@ class RoutingCacheBuilder extends AbstractCacheBuilder */ protected function getCaseInsensitiveControllers() { - $data = [ - 'lookup' => [], - 'reverse' => [], - ]; + $data = []; if (!PACKAGE_ID) { return $data; @@ -142,6 +139,11 @@ class RoutingCacheBuilder extends AbstractCacheBuilder $applications = ApplicationHandler::getInstance()->getApplications(); foreach ($applications as $application) { $abbreviation = $application->getAbbreviation(); + + $data[$abbreviation] = ['acp' => [], 'frontend' => []]; + $this->brokenControllers['lookup'][$abbreviation] = []; + $this->brokenControllers['reverse'][$abbreviation] = []; + $directory = Application::getDirectory($abbreviation); foreach (['lib', 'lib/acp'] as $libDirectory) { foreach (['action', 'form', 'page'] as $pageType) { @@ -192,21 +194,10 @@ class RoutingCacheBuilder extends AbstractCacheBuilder $ciController = \implode('-', \array_map('strtolower', $parts)); $className = $abbreviation . '\\' . ($libDirectory === 'lib/acp' ? 'acp\\' : '') . $pageType . '\\' . $filename; - if (!isset($data['lookup'][$abbreviation])) { - $data['lookup'][$abbreviation] = ['acp' => [], 'frontend' => []]; - } - $data['lookup'][$abbreviation][$libDirectory === 'lib' ? 'frontend' : 'acp'][$ciController] = $className; - $data['reverse'][$filename] = $ciController; + $data[$abbreviation][$libDirectory === 'lib' ? 'frontend' : 'acp'][$ciController] = $className; if ($isBrokenController) { - if (!isset($this->brokenControllers['lookup'][$abbreviation])) { - $this->brokenControllers['lookup'][$abbreviation] = []; - } $this->brokenControllers['lookup'][$abbreviation][$ciController] = $className; - - if (!isset($this->brokenControllers['reverse'][$abbreviation])) { - $this->brokenControllers['reverse'][$abbreviation] = []; - } $this->brokenControllers['reverse'][$abbreviation][\preg_replace( '~(?:Page|Form|Action)$~', '', diff --git a/wcfsetup/install/files/lib/system/request/ControllerMap.class.php b/wcfsetup/install/files/lib/system/request/ControllerMap.class.php index 3b2c15eef7..e484385a05 100644 --- a/wcfsetup/install/files/lib/system/request/ControllerMap.class.php +++ b/wcfsetup/install/files/lib/system/request/ControllerMap.class.php @@ -362,8 +362,8 @@ class ControllerMap extends SingletonFactory protected function getLegacyClassData($application, $controller, $isAcpRequest) { $environment = $isAcpRequest ? 'acp' : 'frontend'; - if (isset($this->ciControllers['lookup'][$application][$environment][$controller])) { - $className = $this->ciControllers['lookup'][$application][$environment][$controller]; + if (isset($this->ciControllers[$application][$environment][$controller])) { + $className = $this->ciControllers[$application][$environment][$controller]; if (\preg_match('~\\\\(?P[^\\\\]+)(Action|Form|Page)$~', $className, $matches)) { return [