forked from Icinga/icingaweb2-module-vspheredb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.php
22 lines (19 loc) · 726 Bytes
/
run.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
/** @var $this \Icinga\Application\Modules\Module */
$this->provideHook('director/ImportSource');
$modules = $this->app->getModuleManager();
foreach ($this->getDependencies() as $module => $required) {
if ($modules->hasEnabled($module)) {
$installed = $modules->getModule($module, false)->getVersion();
$installed = ltrim($installed, 'v'); // v0.6.0 VS 0.6.0
if (preg_match('/^([<>=]+)\s*v?(\d+\.\d+\.\d+)$/', $required, $match)) {
$operator = $match[1];
$vRequired = $match[2];
if (version_compare($installed, $vRequired, $operator)) {
continue;
}
}
}
include __DIR__ . '/run-missingdeps.php';
return;
}