From 0e6aecbd433e470080750666251f8e246d0f8014 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 4 Jun 2014 22:57:50 +0000 Subject: [PATCH] bootstrapping: allow to load modules neither... ...enabled nor installed by passing their base directory. In favour of this parameter I dropped the possibility to inject a Module class for testing purposes. There is no such test and I see no point in doing so. refs #6411 --- library/Icinga/Application/Modules/Manager.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/library/Icinga/Application/Modules/Manager.php b/library/Icinga/Application/Modules/Manager.php index 6fefd3930..a6ca914da 100644 --- a/library/Icinga/Application/Modules/Manager.php +++ b/library/Icinga/Application/Modules/Manager.php @@ -196,23 +196,22 @@ class Manager /** * Try to load the module and register it in the application * - * @param string $name The name of the module to load - * @param mixed $moduleBase Alternative class to use instead of \Icinga\Application\Modules\Module for - * instantiating modules, used for testing + * @param string $name The name of the module to load + * @param mixed $basedir Optional module base directory * - * @return self + * @return self */ - public function loadModule($name, $moduleBase = null) + public function loadModule($name, $basedir = null) { if ($this->hasLoaded($name)) { return $this; } $module = null; - if ($moduleBase === null) { + if ($basedir === null) { $module = new Module($this->app, $name, $this->getModuleDir($name)); } else { - $module = new $moduleBase($this->app, $name, $this->getModuleDir($name)); + $module = new Module($this->app, $name, $basedir); } $module->register(); $this->loadedModules[$name] = $module;