Fix empty module folder causing errors, fix var naming

Fix a wrongly named class causing ClassNotFound issues,
also added additional checks for empty module folder and
added en moduleFolder directive to configure module location

refs #4092
This commit is contained in:
Jannis Moßhammer 2013-06-26 16:05:01 +02:00 committed by Marius Hein
parent 5e5b301d0d
commit d1f4e9831a
6 changed files with 12 additions and 7 deletions

View File

@ -3,6 +3,7 @@ environment = development
timezone = "Europe/Berlin"
indexModule = monitoring
indexController = dashboard
moduleFolder = "/usr/etc/icinga-modules"
[logging]
; General log

View File

@ -100,7 +100,7 @@ abstract class ApplicationBootstrap
public function moduleManager()
{
if ($this->moduleManager === null) {
$this->moduleManager = new ModuleManager($this, "/etc/icinga2/modules_enabled");
$this->moduleManager = new ModuleManager($this, $this->config->global->moduleFolder);
}
return $this->moduleManager;
}

View File

@ -54,7 +54,7 @@ class Manager
public function select()
{
$source = new \Icinga\Data\ArrayDataSource($this->getModuleInfo());
$source = new \Icinga\Data\ArrayDatasource($this->getModuleInfo());
return $source->select();
}
@ -238,7 +238,12 @@ class Manager
public function getModuleInfo()
{
$installed = $this->listInstalledModules();
$info = array();
if ($installed === null) {
return $info;
}
foreach ($installed as $name) {
$info[] = (object) array(
'name' => $name,
@ -265,7 +270,10 @@ class Manager
if ($this->installedBaseDirs === null) {
$this->detectInstalledModules();
}
return array_keys($this->installedBaseDirs);
if ($this->installedBaseDirs !== null) {
return array_keys($this->installedBaseDirs);
}
}
public function detectInstalledModules()

View File

@ -108,6 +108,5 @@
containerMgrInstance = new ContainerMgr($,log,widgets,subTable);
}
return containerMgrInstance;
});
})();

View File

@ -80,5 +80,3 @@ define([
};
return new Icinga();
});

View File

@ -24,4 +24,3 @@ define(['jquery','Holder'], function ($) {
window.Icinga = Icinga;
});
});