Allow to get permissions and restrictions from unloaded modules

refs #9644
This commit is contained in:
Eric Lippmann 2015-07-24 14:24:48 +02:00
parent 444fdadf13
commit 519d025de5
1 changed files with 15 additions and 1 deletions

View File

@ -113,6 +113,13 @@ class Module
*/
private $triedToLaunchConfigScript = false;
/**
* Whether the module's namespace has been registered on our autoloader
*
* @var bool
*/
protected $registeredAutoloader = false;
/**
* Whether this module has been registered
*
@ -855,6 +862,10 @@ class Module
*/
protected function registerAutoloader()
{
if ($this->registeredAutoloader) {
return $this;
}
$moduleName = ucfirst($this->getName());
$moduleLibraryDir = $this->getLibDir(). '/'. $moduleName;
@ -867,6 +878,8 @@ class Module
$this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName. '\\Forms', $moduleFormDir);
}
$this->registeredAutoloader = true;
return $this;
}
@ -1011,7 +1024,7 @@ class Module
*/
protected function launchConfigScript()
{
if ($this->triedToLaunchConfigScript || !$this->registered) {
if ($this->triedToLaunchConfigScript) {
return;
}
$this->triedToLaunchConfigScript = true;
@ -1019,6 +1032,7 @@ class Module
|| ! is_readable($this->configScript)) {
return;
}
$this->registerAutoloader();
include($this->configScript);
}