From 889c0a749c32f9036973c7e84688d5389bcc3ccd Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 28 Jun 2021 10:55:45 +0200 Subject: [PATCH] Module: Report `ipl` and `reactbundle` as library requirements This way modules with the legacy requirement definition can still be enabled without the modules in place. --- library/Icinga/Application/Modules/Module.php | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/library/Icinga/Application/Modules/Module.php b/library/Icinga/Application/Modules/Module.php index 2c13cd018..5d742b7cd 100644 --- a/library/Icinga/Application/Modules/Module.php +++ b/library/Icinga/Application/Modules/Module.php @@ -867,7 +867,19 @@ class Module */ public function getRequiredLibraries() { - return $this->metadata()->libraries; + $requiredLibraries = $this->metadata()->libraries; + + // Register module requirements for ipl and reactbundle as library requirements + $requiredModules = $this->metadata()->modules ?: $this->metadata()->depends; + if (isset($requiredModules['ipl']) && ! isset($requiredLibraries['icinga-php-library'])) { + $requiredLibraries['icinga-php-library'] = $requiredModules['ipl']; + } + + if (isset($requiredModules['reactbundle']) && ! isset($requiredLibraries['icinga-php-thirdparty'])) { + $requiredLibraries['icinga-php-thirdparty'] = $requiredModules['reactbundle']; + } + + return $requiredLibraries; } /** @@ -877,7 +889,12 @@ class Module */ public function getRequiredModules() { - return $this->metadata()->modules ?: $this->metadata()->depends; + $requiredModules = $this->metadata()->modules ?: $this->metadata()->depends; + + // Both modules are deprecated and their successors are now dependencies of web itself + unset($requiredModules['ipl'], $requiredModules['reactbundle']); + + return $requiredModules; } /**