From: Tim Düsterhus Date: Fri, 20 May 2022 12:15:58 +0000 (+0200) Subject: Remove the `pageType` from `\wcf\system\request\Request` X-Git-Tag: 6.0.0_Alpha_1~1259^2~10 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=deca23e1caf47e783a99722b7d2ce941bd829bc6;p=GitHub%2FWoltLab%2FWCF.git Remove the `pageType` from `\wcf\system\request\Request` This value is currently unused, incorrectly documented (`page` was a valid value since the addition of CMS pages), of questionable value and will break with the addition of PSR-15 controllers. --- diff --git a/wcfsetup/install/files/lib/system/request/ControllerMap.class.php b/wcfsetup/install/files/lib/system/request/ControllerMap.class.php index ac0b7aa771..ca63a1b467 100644 --- a/wcfsetup/install/files/lib/system/request/ControllerMap.class.php +++ b/wcfsetup/install/files/lib/system/request/ControllerMap.class.php @@ -68,7 +68,7 @@ class ControllerMap extends SingletonFactory * @param string $controller url controller * @param bool $isAcpRequest true if this is an ACP request * @param bool $skipCustomUrls true if custom url resolution should be suppressed, is always true for ACP requests - * @return mixed array containing className, controller and pageType or a string containing the controller name for aliased controllers + * @return mixed array containing className and controller or a string containing the controller name for aliased controllers * @throws SystemException */ public function resolve($application, $controller, $isAcpRequest, $skipCustomUrls = false) @@ -167,7 +167,6 @@ class ControllerMap extends SingletonFactory return [ 'className' => CmsPage::class, 'controller' => 'cms', - 'pageType' => 'page', // CMS page meta data 'cmsPageID' => $matches['pageID'], @@ -179,7 +178,6 @@ class ControllerMap extends SingletonFactory return [ 'className' => $data, 'controller' => $matches[1], - 'pageType' => \strtolower($matches[2]), ]; } } @@ -399,7 +397,7 @@ class ControllerMap extends SingletonFactory * @param string $application application identifier * @param string $controller controller name * @param bool $isAcpRequest true if this is an ACP request - * @return string[]|null className, controller and pageType, or null if this is not a legacy controller name + * @return string[]|null className and controller, or null if this is not a legacy controller name */ protected function getLegacyClassData($application, $controller, $isAcpRequest) { @@ -407,11 +405,10 @@ class ControllerMap extends SingletonFactory if (isset($this->ciControllers['lookup'][$application][$environment][$controller])) { $className = $this->ciControllers['lookup'][$application][$environment][$controller]; - if (\preg_match('~\\\\(?P[^\\\\]+)(?PAction|Form|Page)$~', $className, $matches)) { + if (\preg_match('~\\\\(?P[^\\\\]+)(Action|Form|Page)$~', $className, $matches)) { return [ 'className' => $className, 'controller' => $matches['controller'], - 'pageType' => \strtolower($matches['pageType']), ]; } } @@ -427,7 +424,7 @@ class ControllerMap extends SingletonFactory * @param string $controller controller name * @param bool $isAcpRequest true if this is an ACP request * @param string $pageType page type, e.g. 'form' or 'action' - * @return string[]|null className, controller and pageType + * @return string[]|null className and controller */ protected function getClassData($application, $controller, $isAcpRequest, $pageType) { @@ -453,7 +450,6 @@ class ControllerMap extends SingletonFactory return [ 'className' => $className, 'controller' => $controller, - 'pageType' => $pageType, ]; } diff --git a/wcfsetup/install/files/lib/system/request/Request.class.php b/wcfsetup/install/files/lib/system/request/Request.class.php index d20c144fae..64dfdabe24 100644 --- a/wcfsetup/install/files/lib/system/request/Request.class.php +++ b/wcfsetup/install/files/lib/system/request/Request.class.php @@ -47,12 +47,6 @@ final class Request implements RequestHandlerInterface */ protected $pageName = ''; - /** - * page type - * @var string - */ - protected $pageType = ''; - /** * request object * @var object @@ -64,15 +58,13 @@ final class Request implements RequestHandlerInterface * * @param string $className fully qualified name * @param string $pageName class name - * @param string $pageType can be 'action', 'form' or 'page' * @param string[] $metaData additional meta data */ - public function __construct($className, $pageName, $pageType, array $metaData) + public function __construct($className, $pageName, array $metaData) { $this->className = $className; $this->metaData = $metaData; $this->pageName = $pageName; - $this->pageType = $pageType; } /** @@ -154,16 +146,6 @@ final class Request implements RequestHandlerInterface return $this->pageName; } - /** - * Returns the page type of this request. - * - * @return string - */ - public function getPageType() - { - return $this->pageType; - } - /** * Returns the current request object. * diff --git a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php index 9b4c719ff3..f848de4d8f 100644 --- a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php +++ b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php @@ -153,12 +153,10 @@ class RequestHandler extends SingletonFactory $classData = [ 'className' => $routeData['className'], 'controller' => $routeData['controller'], - 'pageType' => $routeData['pageType'], ]; unset($routeData['className']); unset($routeData['controller']); - unset($routeData['pageType']); } else { if ( $this->isACPRequest() @@ -216,7 +214,6 @@ class RequestHandler extends SingletonFactory $this->activeRequest = new Request( $classData['className'], $classData['controller'], - $classData['pageType'], $metaData );