Autoloader should not fail on missing module library directory

This commit is contained in:
Thomas Gelf 2014-02-14 13:38:55 +00:00
parent 7dbede12fb
commit db6dbdd381
1 changed files with 7 additions and 3 deletions

View File

@ -399,9 +399,13 @@ class Module
*/ */
protected function registerAutoloader() protected function registerAutoloader()
{ {
if (is_dir($this->getBaseDir()) && is_dir($this->getLibDir())) { $moduleName = ucfirst($this->getName());
$moduleName = ucfirst($this->getName()); $moduleLibraryDir = $this->getLibDir(). '/'. $moduleName;
$moduleLibraryDir = $this->getLibDir(). '/'. $moduleName; if (
is_dir($this->getBaseDir()) &&
is_dir($this->getLibDir()) &&
is_dir($moduleLibraryDir)
) {
$this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName, $moduleLibraryDir); $this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName, $moduleLibraryDir);
if (is_dir($this->getFormDir())) { if (is_dir($this->getFormDir())) {