throw new SystemException("Malformed controller name '" . $controller . "'");
}
- $parts = explode('-', $controller);
- $parts = array_map('ucfirst', $parts);
- $controller = implode('', $parts);
-
- if ($controller === 'AjaxProxy') $controller = 'AJAXProxy';
-
- $classData = $this->getClassData($application, $controller, $isAcpRequest, 'page');
- if ($classData === null) $classData = $this->getClassData($application, $controller, $isAcpRequest, 'form');
- if ($classData === null) $classData = $this->getClassData($application, $controller, $isAcpRequest, 'action');
+ $classData = $this->getLegacyClassData($application, $controller, $isAcpRequest);
+ if ($classData === null) {
+ $parts = explode('-', $controller);
+ $parts = array_map('ucfirst', $parts);
+ $controller = implode('', $parts);
+
+ // work-around for upgrade path 2.1 -> 2.2
+ if ($controller === 'AjaxProxy') $controller = 'AJAXProxy';
+
+ $classData = $this->getClassData($application, $controller, $isAcpRequest, 'page');
+ if ($classData === null) $classData = $this->getClassData($application, $controller, $isAcpRequest, 'form');
+ if ($classData === null) $classData = $this->getClassData($application, $controller, $isAcpRequest, 'action');
+ }
if ($classData === null) {
throw new SystemException("Unknown controller '" . $controller . "'");
return true;
}
+ /**
+ * Lookups the list of legacy controller names that violate the name
+ * schema, e.g. are named 'BBCodeList' instead of `BbCodeList`.
+ *
+ * @param string $application application identifier
+ * @param string $controller controller name
+ * @param boolean $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
+ */
+ 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 (preg_match('~\\\\(?P<controller>[^\\\\]+)(?P<pageType>Action|Form|Page)$~', $className, $matches)) {
+ return [
+ 'className' => $className,
+ 'controller' => $matches['controller'],
+ 'pageType' => strtolower($matches['pageType'])
+ ];
+ }
+ }
+
+ return null;
+ }
+
/**
* Returns the class data for the active request or null if for the given
* configuration no proper class exist.