mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
run.php: Fix incorrect namespace registration for module monitoring
This commit is contained in:
parent
4ee7eefd98
commit
2051b29656
1 changed files with 20 additions and 7 deletions
27
run.php
27
run.php
|
|
@ -9,11 +9,24 @@ $this->provideHook('X509/Sni');
|
|||
$this->provideHook('health', 'IcingaHealth');
|
||||
$this->provideHook('health', 'RedisHealth');
|
||||
|
||||
if (! $this->app->getModuleManager()->hasEnabled('monitoring')) {
|
||||
// Ensure we can load some classes/interfaces for compatibility with legacy hooks
|
||||
$this->app->getLoader()->registerNamespace(
|
||||
'Icinga\\Module\\Monitoring',
|
||||
$this->getLibDir() . '/Monitoring',
|
||||
$this->getApplicationDir()
|
||||
);
|
||||
if (! $this::exists('monitoring')) {
|
||||
$modulePath = null;
|
||||
foreach ($this->app->getModuleManager()->getModuleDirs() as $path) {
|
||||
$pathToTest = join(DIRECTORY_SEPARATOR, [$path, 'monitoring']);
|
||||
if (file_exists($pathToTest)) {
|
||||
$modulePath = $pathToTest;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($modulePath === null) {
|
||||
Icinga\Application\Logger::error('Unable to locate monitoring module');
|
||||
} else {
|
||||
// Ensure we can load some classes/interfaces for compatibility with legacy hooks
|
||||
$this->app->getLoader()->registerNamespace(
|
||||
'Icinga\\Module\\Monitoring',
|
||||
join(DIRECTORY_SEPARATOR, [$modulePath, 'library', 'Monitoring']),
|
||||
join(DIRECTORY_SEPARATOR, [$modulePath, 'application'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue