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.
This commit is contained in:
Johannes Meyer 2021-06-28 10:55:45 +02:00
parent 3b6a10ecaa
commit 889c0a749c
1 changed files with 19 additions and 2 deletions

View File

@ -867,7 +867,19 @@ class Module
*/ */
public function getRequiredLibraries() 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() 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;
} }
/** /**