mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 06:14:25 +02:00
Splitted module manager setup and module loading in bootstrap code
Allows different implementations (Web, Cli...) to behave differently without duplicating code
This commit is contained in:
parent
e037716585
commit
bb1c560e22
@ -337,14 +337,23 @@ abstract class ApplicationBootstrap
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup module loader and all enabled modules
|
* Setup module manager
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function setupModules()
|
protected function setupModuleManager()
|
||||||
{
|
{
|
||||||
$this->moduleManager = new ModuleManager($this, $this->configDir . '/enabledModules');
|
$this->moduleManager = new ModuleManager($this, $this->configDir . '/enabledModules');
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all enabled modules
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
protected function loadEnabledModules()
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$this->moduleManager->loadEnabledModules();
|
$this->moduleManager->loadEnabledModules();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -67,7 +67,7 @@ class Cli extends ApplicationBootstrap
|
|||||||
->fixLoggingConfig()
|
->fixLoggingConfig()
|
||||||
->setupErrorHandling()
|
->setupErrorHandling()
|
||||||
->setupResourceFactory()
|
->setupResourceFactory()
|
||||||
->setupModules()
|
->setupModuleManager()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,34 +93,6 @@ class Cli extends ApplicationBootstrap
|
|||||||
return $this->cliLoader;
|
return $this->cliLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup module loader
|
|
||||||
*
|
|
||||||
* TODO: This can be removed once broken bootstrapping has been fixed
|
|
||||||
* Loading the module manager and enabling all modules have former
|
|
||||||
* been two different tasks. CLI does NOT enable any module by default.
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
protected function setupModules()
|
|
||||||
{
|
|
||||||
$this->moduleManager = new ModuleManager($this, $this->getConfigDir('enabledModules'));
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for module manager
|
|
||||||
*
|
|
||||||
* TODO: This can also be removed once fixed. Making everything private
|
|
||||||
* made this duplication necessary
|
|
||||||
*
|
|
||||||
* @return ModuleManager
|
|
||||||
*/
|
|
||||||
public function getModuleManager()
|
|
||||||
{
|
|
||||||
return $this->moduleManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function parseBasicParams()
|
protected function parseBasicParams()
|
||||||
{
|
{
|
||||||
$this->params = Params::parse();
|
$this->params = Params::parse();
|
||||||
|
@ -110,7 +110,8 @@ class Web extends ApplicationBootstrap
|
|||||||
->setupRequest()
|
->setupRequest()
|
||||||
->setupZendMvc()
|
->setupZendMvc()
|
||||||
->setupTranslation()
|
->setupTranslation()
|
||||||
->setupModules()
|
->setupModuleManager()
|
||||||
|
->loadEnabledModules()
|
||||||
->setupRoute()
|
->setupRoute()
|
||||||
->setupPagination();
|
->setupPagination();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user