From d585a376412a8fbbf6d4c09158e662e76af438f7 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 30 Apr 2020 16:43:24 +0200 Subject: [PATCH] setup: Introduce class `WebModuleRequirement` --- .../Requirement/WebModuleRequirement.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 modules/setup/library/Setup/Requirement/WebModuleRequirement.php diff --git a/modules/setup/library/Setup/Requirement/WebModuleRequirement.php b/modules/setup/library/Setup/Requirement/WebModuleRequirement.php new file mode 100644 index 000000000..c15d0c3a4 --- /dev/null +++ b/modules/setup/library/Setup/Requirement/WebModuleRequirement.php @@ -0,0 +1,25 @@ +getCondition(); + + $mm = Icinga::app()->getModuleManager(); + if (! $mm->hasInstalled($name)) { + $this->setStateText(sprintf(mt('setup', '%s is not installed'), $this->getAlias())); + return false; + } + + $module = $mm->getModule($name, false); + $this->setStateText(sprintf(mt('setup', '%s version: %s'), $this->getAlias(), $module->getVersion())); + return version_compare($module->getVersion(), $version, $op); + } +}