WebWizard: Require our new libraries

This commit is contained in:
Johannes Meyer 2021-06-22 12:35:22 +02:00
parent 3b3eca934f
commit fa602c3525
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<?php
/* Icinga Web 2 | (c) 2021 Icinga GmbH | GPLv2+ */
namespace Icinga\Module\Setup\Requirement;
use Icinga\Application\Icinga;
use Icinga\Module\Setup\Requirement;
class WebLibraryRequirement extends Requirement
{
protected function evaluate()
{
list($name, $op, $version) = $this->getCondition();
$libs = Icinga::app()->getLibraries();
if (! $libs->has($name)) {
$this->setStateText(sprintf(mt('setup', '%s is not installed'), $this->getAlias()));
return false;
}
$this->setStateText(sprintf(mt('setup', '%s version: %s'), $this->getAlias(), $libs->get($name)->getVersion()));
return $libs->has($name, $op . $version);
}
}

View File

@ -4,6 +4,7 @@
namespace Icinga\Module\Setup;
use Icinga\Module\Setup\Requirement\SetRequirement;
use Icinga\Module\Setup\Requirement\WebLibraryRequirement;
use PDOException;
use Icinga\Web\Form;
use Icinga\Web\Wizard;
@ -582,6 +583,24 @@ class WebWizard extends Wizard implements SetupWizard
)
)));
$set->add(new WebLibraryRequirement(array(
'condition' => ['icinga-php-library', '>=', '0.6.0'],
'alias' => 'Icinga PHP library',
'description' => mt(
'setup',
'The Icinga PHP library (IPL) is required for Icinga Web 2 and modules'
)
)));
$set->add(new WebLibraryRequirement(array(
'condition' => ['icinga-php-thirdparty', '>=', '0.10.0'],
'alias' => 'Icinga PHP Thirdparty',
'description' => mt(
'setup',
'The Icinga PHP Thirdparty library is required for Icinga Web 2 and modules'
)
)));
$set->add(new PhpModuleRequirement(array(
'condition' => 'OpenSSL',
'description' => mt(