Multiple installations paths for all Bootstrappers

No longer instantiating moduleManager twice, now the CLI is also
able to benefit from multiple module installation paths. Modules
lists are now sorted.
This commit is contained in:
Thomas Gelf 2014-01-24 09:48:30 +00:00
parent db22945f1e
commit e0af544c14
2 changed files with 8 additions and 7 deletions

View File

@ -343,7 +343,11 @@ abstract class ApplicationBootstrap
*/ */
protected function setupModuleManager() protected function setupModuleManager()
{ {
$this->moduleManager = new ModuleManager($this, $this->configDir . '/enabledModules'); $this->moduleManager = new ModuleManager(
$this,
$this->configDir . '/enabledModules',
explode(':', $this->config->global->get('modulePath', ICINGA_APPDIR . '/../modules'))
);
return $this; return $this;
} }
@ -354,11 +358,6 @@ abstract class ApplicationBootstrap
*/ */
protected function loadEnabledModules() protected function loadEnabledModules()
{ {
$this->moduleManager = new ModuleManager(
$this,
$this->config->global->get('moduleFolder', $this->getConfigDir() . '/enabledModules'),
explode(':', $this->config->global->get('modulePath', ICINGA_APPDIR . '/../modules'))
);
try { try {
$this->moduleManager->loadEnabledModules(); $this->moduleManager->loadEnabledModules();
} catch (Exception $e) { } catch (Exception $e) {

View File

@ -181,6 +181,7 @@ class Manager
} }
$this->enabledDirs[$file] = $dir; $this->enabledDirs[$file] = $dir;
ksort($this->enabledDirs);
} }
} }
@ -520,7 +521,7 @@ class Manager
continue; continue;
} }
if (is_dir($basedir . '/' . $name)) { if (is_dir($basedir . '/' . $name)) {
if (!array_key_exists($name, $this->installedBaseDirs)) { if (! array_key_exists($name, $this->installedBaseDirs)) {
$this->installedBaseDirs[$name] = $basedir . '/' . $name; $this->installedBaseDirs[$name] = $basedir . '/' . $name;
} else { } else {
Logger::warn( Logger::warn(
@ -532,6 +533,7 @@ class Manager
} }
} }
} }
ksort($this->installedBaseDirs);
return $this; return $this;
} }
} }