mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 22:34:24 +02:00
Module: less stat calls, less work to do
This commit is contained in:
parent
99a6bc12a9
commit
d0ce9f86d8
@ -1061,18 +1061,13 @@ class Module
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
$loader = $this->app->getLoader();
|
|
||||||
$moduleName = ucfirst($this->getName());
|
$moduleName = ucfirst($this->getName());
|
||||||
|
|
||||||
$moduleLibraryDir = $this->getLibDir(). '/'. $moduleName;
|
$this->app->getLoader()->registerNamespace(
|
||||||
if (is_dir($moduleLibraryDir)) {
|
'Icinga\\Module\\' . $moduleName,
|
||||||
$loader->registerNamespace('Icinga\\Module\\' . $moduleName, $moduleLibraryDir);
|
$this->getLibDir() . '/'. $moduleName,
|
||||||
}
|
$this->getApplicationDir()
|
||||||
|
);
|
||||||
$moduleFormDir = $this->getFormDir();
|
|
||||||
if (is_dir($moduleFormDir)) {
|
|
||||||
$loader->registerNamespace('Icinga\\Module\\' . $moduleName. '\\Forms', $moduleFormDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->registeredAutoloader = true;
|
$this->registeredAutoloader = true;
|
||||||
|
|
||||||
@ -1136,21 +1131,10 @@ class Module
|
|||||||
if (! $this->app->isWeb()) {
|
if (! $this->app->isWeb()) {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
$moduleControllerDir = $this->getControllerDir();
|
|
||||||
if (is_dir($moduleControllerDir)) {
|
return $this
|
||||||
$this->app->getfrontController()->addControllerDirectory(
|
|
||||||
$moduleControllerDir,
|
|
||||||
$this->getName()
|
|
||||||
);
|
|
||||||
$this->app->getLoader()->registerNamespace(
|
|
||||||
'Icinga\\Module\\' . ucfirst($this->getName()) . '\\' . Dispatcher::CONTROLLER_NAMESPACE,
|
|
||||||
$moduleControllerDir
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$this
|
|
||||||
->registerLocales()
|
->registerLocales()
|
||||||
->registerRoutes();
|
->registerRoutes();
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1161,6 +1145,13 @@ class Module
|
|||||||
protected function registerRoutes()
|
protected function registerRoutes()
|
||||||
{
|
{
|
||||||
$router = $this->app->getFrontController()->getRouter();
|
$router = $this->app->getFrontController()->getRouter();
|
||||||
|
|
||||||
|
// TODO: We should not be required to do this. Please check dispatch()
|
||||||
|
$this->app->getfrontController()->addControllerDirectory(
|
||||||
|
$this->getControllerDir(),
|
||||||
|
$this->getName()
|
||||||
|
);
|
||||||
|
|
||||||
/** @var \Zend_Controller_Router_Rewrite $router */
|
/** @var \Zend_Controller_Router_Rewrite $router */
|
||||||
foreach ($this->routes as $name => $route) {
|
foreach ($this->routes as $name => $route) {
|
||||||
$router->addRoute($name, $route);
|
$router->addRoute($name, $route);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user