mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 01:04:09 +02:00
modules: Register controller namesoace in Module::registerWebIntegration()
Else we get an exception when loading modules on the CLI because Zend classes are not autoloaded. refs #5786
This commit is contained in:
parent
fba9780405
commit
f24449b225
@ -958,14 +958,6 @@ class Module
|
|||||||
$loader->registerNamespace('Icinga\\Module\\' . $moduleName. '\\Forms', $moduleFormDir);
|
$loader->registerNamespace('Icinga\\Module\\' . $moduleName. '\\Forms', $moduleFormDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
$moduleControllerDir = $this->getControllerDir();
|
|
||||||
if (is_dir($moduleControllerDir)) {
|
|
||||||
$loader->registerNamespace(
|
|
||||||
'Icinga\\Module\\' . $moduleName . '\\' . Dispatcher::CONTROLLER_NAMESPACE,
|
|
||||||
$moduleControllerDir
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->registeredAutoloader = true;
|
$this->registeredAutoloader = true;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -1025,18 +1017,22 @@ class Module
|
|||||||
*/
|
*/
|
||||||
protected function registerWebIntegration()
|
protected function registerWebIntegration()
|
||||||
{
|
{
|
||||||
if (!$this->app->isWeb()) {
|
if (! $this->app->isWeb()) {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
$moduleControllerDir = $this->getControllerDir();
|
||||||
if (file_exists($this->controllerdir) && is_dir($this->controllerdir)) {
|
if (is_dir($moduleControllerDir)) {
|
||||||
$this->app->getfrontController()->addControllerDirectory(
|
$this->app->getfrontController()->addControllerDirectory(
|
||||||
$this->controllerdir,
|
$moduleControllerDir,
|
||||||
$this->name
|
$this->getName()
|
||||||
|
);
|
||||||
|
$this->app->getLoader()->registerNamespace(
|
||||||
|
'Icinga\\Module\\' . ucfirst($this->getName()) . '\\' . Dispatcher::CONTROLLER_NAMESPACE,
|
||||||
|
$moduleControllerDir
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
$this
|
||||||
$this->registerLocales()
|
->registerLocales()
|
||||||
->registerRoutes();
|
->registerRoutes();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user