mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 09:14:08 +02:00
Add support for "core" modules and make the setup module such a module
refs #7163
This commit is contained in:
parent
6b2f434f32
commit
8af13f564b
@ -324,6 +324,21 @@ abstract class ApplicationBootstrap
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all core modules
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
protected function loadCoreModules()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->moduleManager->loadCoreModules();
|
||||||
|
} catch (NotReadableError $e) {
|
||||||
|
Logger::error(new IcingaException('Cannot load core modules. An exception was thrown:', $e));
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all enabled modules
|
* Load all enabled modules
|
||||||
*
|
*
|
||||||
|
@ -31,6 +31,7 @@ class EmbeddedWeb extends ApplicationBootstrap
|
|||||||
->setupErrorHandling()
|
->setupErrorHandling()
|
||||||
->setupTimezone()
|
->setupTimezone()
|
||||||
->setupModuleManager()
|
->setupModuleManager()
|
||||||
|
->loadCoreModules()
|
||||||
->loadEnabledModules();
|
->loadEnabledModules();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,18 @@ class Manager
|
|||||||
*/
|
*/
|
||||||
private $modulePaths = array();
|
private $modulePaths = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The core modules
|
||||||
|
*
|
||||||
|
* Core modules do not need to be enabled to load and cannot be disabled
|
||||||
|
* by the user. This must not be writable programmatically!
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $coreModules = array(
|
||||||
|
'setup'
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance of the module manager
|
* Create a new instance of the module manager
|
||||||
*
|
*
|
||||||
@ -157,7 +169,21 @@ class Manager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to set all enabled modules in loaded sate
|
* Try to set all core modules in loaded state
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @see Manager::loadModule()
|
||||||
|
*/
|
||||||
|
public function loadCoreModules()
|
||||||
|
{
|
||||||
|
foreach ($this->coreModules as $name) {
|
||||||
|
$this->loadModule($name);
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to set all enabled modules in loaded state
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
* @see Manager::loadModule()
|
* @see Manager::loadModule()
|
||||||
@ -211,6 +237,8 @@ class Manager
|
|||||||
'Cannot enable module "%s". Module is not installed.',
|
'Cannot enable module "%s". Module is not installed.',
|
||||||
$name
|
$name
|
||||||
);
|
);
|
||||||
|
} elseif (in_array($name, $this->coreModules)) {
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearstatcache(true);
|
clearstatcache(true);
|
||||||
@ -427,7 +455,7 @@ class Manager
|
|||||||
}
|
}
|
||||||
|
|
||||||
$installed = $this->listInstalledModules();
|
$installed = $this->listInstalledModules();
|
||||||
foreach ($installed as $name) {
|
foreach (array_diff($installed, $this->coreModules) as $name) {
|
||||||
$info[$name] = (object) array(
|
$info[$name] = (object) array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'path' => $this->installedBaseDirs[$name],
|
'path' => $this->installedBaseDirs[$name],
|
||||||
|
@ -92,6 +92,7 @@ class Web extends ApplicationBootstrap
|
|||||||
->setupZendMvc()
|
->setupZendMvc()
|
||||||
->setupFormNamespace()
|
->setupFormNamespace()
|
||||||
->setupModuleManager()
|
->setupModuleManager()
|
||||||
|
->loadCoreModules()
|
||||||
->loadEnabledModules()
|
->loadEnabledModules()
|
||||||
->setupRoute()
|
->setupRoute()
|
||||||
->setupPagination();
|
->setupPagination();
|
||||||
|
@ -101,7 +101,7 @@ class GettextTranslationHelper
|
|||||||
*/
|
*/
|
||||||
public function __construct(ApplicationBootstrap $bootstrap, $locale)
|
public function __construct(ApplicationBootstrap $bootstrap, $locale)
|
||||||
{
|
{
|
||||||
$this->moduleMgr = $bootstrap->getModuleManager()->loadEnabledModules();
|
$this->moduleMgr = $bootstrap->getModuleManager()->loadCoreModules()->loadEnabledModules();
|
||||||
$this->appDir = $bootstrap->getApplicationDir();
|
$this->appDir = $bootstrap->getApplicationDir();
|
||||||
$this->locale = $locale;
|
$this->locale = $locale;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user