mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-21 21:04:25 +02:00
parent
c4c248cbb7
commit
3040116c12
@ -11,7 +11,17 @@ $requirements = $form->getRequirements();
|
|||||||
<?php foreach ($requirements as $requirement): ?>
|
<?php foreach ($requirements as $requirement): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><h2><?= $requirement->title; ?></h2></td>
|
<td><h2><?= $requirement->title; ?></h2></td>
|
||||||
<td style="width: 50%"><?= $requirement->description; ?></td>
|
<td style="width: 50%">
|
||||||
|
<?php if (is_array($requirement->description)): ?>
|
||||||
|
<ul>
|
||||||
|
<?php foreach ($requirement->description as $desc): ?>
|
||||||
|
<li><?= $desc; ?></li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= $requirement->description; ?>
|
||||||
|
<?php endif ?>
|
||||||
|
</td>
|
||||||
<td class="state <?= $requirement->state === Requirements::STATE_OK ? 'fulfilled' : (
|
<td class="state <?= $requirement->state === Requirements::STATE_OK ? 'fulfilled' : (
|
||||||
$requirement->state === Requirements::STATE_OPTIONAL ? 'not-available' : 'missing'
|
$requirement->state === Requirements::STATE_OPTIONAL ? 'not-available' : 'missing'
|
||||||
); ?>"><?= $requirement->message; ?></td>
|
); ?>"><?= $requirement->message; ?></td>
|
||||||
|
@ -9,6 +9,9 @@ use IteratorAggregate;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Container to store and handle requirements
|
* Container to store and handle requirements
|
||||||
|
*
|
||||||
|
* TODO: Requirements should be registered as objects with a specific purpose (PhpModRequirement, PhpIniRequirement, ..)
|
||||||
|
* so that it's not necessary to define unique identifiers which may differ between different modules.
|
||||||
*/
|
*/
|
||||||
class Requirements implements IteratorAggregate
|
class Requirements implements IteratorAggregate
|
||||||
{
|
{
|
||||||
@ -41,12 +44,40 @@ class Requirements implements IteratorAggregate
|
|||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function add($requirement)
|
public function add($name, $requirement)
|
||||||
{
|
{
|
||||||
$this->requirements[] = $requirement;
|
$this->requirements[$name] = array_key_exists($name, $this->requirements)
|
||||||
|
? $this->combine($this->requirements[$name], $requirement)
|
||||||
|
: $requirement;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Combine the two given requirements
|
||||||
|
*
|
||||||
|
* Returns the most important requirement with the description from the other one being added.
|
||||||
|
*
|
||||||
|
* @param object $oldRequirement
|
||||||
|
* @param object $newRequirement
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
protected function combine($oldRequirement, $newRequirement)
|
||||||
|
{
|
||||||
|
if ($newRequirement->state === static::STATE_MANDATORY && $oldRequirement->state === static::STATE_OPTIONAL) {
|
||||||
|
$tempRequirement = $oldRequirement;
|
||||||
|
$oldRequirement = $newRequirement;
|
||||||
|
$newRequirement = $tempRequirement;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! is_array($oldRequirement->description)) {
|
||||||
|
$oldRequirement->description = array($oldRequirement->description);
|
||||||
|
}
|
||||||
|
|
||||||
|
$oldRequirement->description[] = $newRequirement->description;
|
||||||
|
return $oldRequirement;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all registered requirements
|
* Return all registered requirements
|
||||||
*
|
*
|
||||||
@ -70,6 +101,7 @@ class Requirements implements IteratorAggregate
|
|||||||
/**
|
/**
|
||||||
* Register an optional requirement
|
* Register an optional requirement
|
||||||
*
|
*
|
||||||
|
* @param string $name
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @param string $description
|
* @param string $description
|
||||||
* @param bool $state
|
* @param bool $state
|
||||||
@ -77,20 +109,24 @@ class Requirements implements IteratorAggregate
|
|||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function addOptional($title, $description, $state, $message)
|
public function addOptional($name, $title, $description, $state, $message)
|
||||||
{
|
{
|
||||||
$this->add((object) array(
|
$this->add(
|
||||||
'title' => $title,
|
$name,
|
||||||
'message' => $message,
|
(object) array(
|
||||||
'description' => $description,
|
'title' => $title,
|
||||||
'state' => (bool) $state ? static::STATE_OK : static::STATE_OPTIONAL
|
'message' => $message,
|
||||||
));
|
'description' => $description,
|
||||||
|
'state' => (bool) $state ? static::STATE_OK : static::STATE_OPTIONAL
|
||||||
|
)
|
||||||
|
);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a mandatory requirement
|
* Register a mandatory requirement
|
||||||
*
|
*
|
||||||
|
* @param string $name
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @param string $description
|
* @param string $description
|
||||||
* @param bool $state
|
* @param bool $state
|
||||||
@ -98,14 +134,17 @@ class Requirements implements IteratorAggregate
|
|||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function addMandatory($title, $description, $state, $message)
|
public function addMandatory($name, $title, $description, $state, $message)
|
||||||
{
|
{
|
||||||
$this->add((object) array(
|
$this->add(
|
||||||
'title' => $title,
|
$name,
|
||||||
'message' => $message,
|
(object) array(
|
||||||
'description' => $description,
|
'title' => $title,
|
||||||
'state' => (bool) $state ? static::STATE_OK : static::STATE_MANDATORY
|
'message' => $message,
|
||||||
));
|
'description' => $description,
|
||||||
|
'state' => (bool) $state ? static::STATE_OK : static::STATE_MANDATORY
|
||||||
|
)
|
||||||
|
);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,8 +157,8 @@ class Requirements implements IteratorAggregate
|
|||||||
*/
|
*/
|
||||||
public function merge(Requirements $requirements)
|
public function merge(Requirements $requirements)
|
||||||
{
|
{
|
||||||
foreach ($requirements->getAll() as $requirement) {
|
foreach ($requirements->getAll() as $name => $requirement) {
|
||||||
$this->add($requirement);
|
$this->add($name, $requirement);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -366,6 +366,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
|
|
||||||
$phpVersion = Platform::getPhpVersion();
|
$phpVersion = Platform::getPhpVersion();
|
||||||
$requirements->addMandatory(
|
$requirements->addMandatory(
|
||||||
|
'php_version_>=_5_3_2',
|
||||||
mt('setup', 'PHP Version'),
|
mt('setup', 'PHP Version'),
|
||||||
mt(
|
mt(
|
||||||
'setup',
|
'setup',
|
||||||
@ -378,6 +379,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
|
|
||||||
$defaultTimezone = Platform::getPhpConfig('date.timezone');
|
$defaultTimezone = Platform::getPhpConfig('date.timezone');
|
||||||
$requirements->addMandatory(
|
$requirements->addMandatory(
|
||||||
|
'existing_default_timezone',
|
||||||
mt('setup', 'Default Timezone'),
|
mt('setup', 'Default Timezone'),
|
||||||
sprintf(
|
sprintf(
|
||||||
mt('setup', 'It is required that a default timezone has been set using date.timezone in %s.'),
|
mt('setup', 'It is required that a default timezone has been set using date.timezone in %s.'),
|
||||||
@ -390,6 +392,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
|
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
|
'platform=linux',
|
||||||
mt('setup', 'Linux Platform'),
|
mt('setup', 'Linux Platform'),
|
||||||
mt(
|
mt(
|
||||||
'setup',
|
'setup',
|
||||||
@ -401,6 +404,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
|
|
||||||
$requirements->addMandatory(
|
$requirements->addMandatory(
|
||||||
|
'existing_php_mod_openssl',
|
||||||
mt('setup', 'PHP Module: OpenSSL'),
|
mt('setup', 'PHP Module: OpenSSL'),
|
||||||
mt('setup', 'The PHP module for OpenSSL is required to generate cryptographically safe password salts.'),
|
mt('setup', 'The PHP module for OpenSSL is required to generate cryptographically safe password salts.'),
|
||||||
Platform::extensionLoaded('openssl'),
|
Platform::extensionLoaded('openssl'),
|
||||||
@ -410,6 +414,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
|
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
|
'existing_php_mod_json',
|
||||||
mt('setup', 'PHP Module: JSON'),
|
mt('setup', 'PHP Module: JSON'),
|
||||||
mt('setup', 'The JSON module for PHP is required for various export functionalities as well as APIs.'),
|
mt('setup', 'The JSON module for PHP is required for various export functionalities as well as APIs.'),
|
||||||
Platform::extensionLoaded('json'),
|
Platform::extensionLoaded('json'),
|
||||||
@ -419,6 +424,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
|
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
|
'existing_php_mod_ldap',
|
||||||
mt('setup', 'PHP Module: LDAP'),
|
mt('setup', 'PHP Module: LDAP'),
|
||||||
mt('setup', 'If you\'d like to authenticate users using LDAP the corresponding PHP module is required'),
|
mt('setup', 'If you\'d like to authenticate users using LDAP the corresponding PHP module is required'),
|
||||||
Platform::extensionLoaded('ldap'),
|
Platform::extensionLoaded('ldap'),
|
||||||
@ -428,6 +434,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
|
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
|
'existing_php_mod_intl',
|
||||||
mt('setup', 'PHP Module: INTL'),
|
mt('setup', 'PHP Module: INTL'),
|
||||||
mt(
|
mt(
|
||||||
'setup',
|
'setup',
|
||||||
@ -442,6 +449,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
|
|
||||||
// TODO(6172): Remove this requirement once we do not ship dompdf with Icinga Web 2 anymore
|
// TODO(6172): Remove this requirement once we do not ship dompdf with Icinga Web 2 anymore
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
|
'existing_php_mod_dom',
|
||||||
mt('setup', 'PHP Module: DOM'),
|
mt('setup', 'PHP Module: DOM'),
|
||||||
mt('setup', 'To be able to export views and reports to PDF, the DOM module for PHP is required.'),
|
mt('setup', 'To be able to export views and reports to PDF, the DOM module for PHP is required.'),
|
||||||
Platform::extensionLoaded('dom'),
|
Platform::extensionLoaded('dom'),
|
||||||
@ -451,6 +459,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
|
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
|
'existing_php_mod_gd',
|
||||||
mt('setup', 'PHP Module: GD'),
|
mt('setup', 'PHP Module: GD'),
|
||||||
mt(
|
mt(
|
||||||
'setup',
|
'setup',
|
||||||
@ -464,6 +473,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
|
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
|
'existing_php_mod_imagick',
|
||||||
mt('setup', 'PHP Module: Imagick'),
|
mt('setup', 'PHP Module: Imagick'),
|
||||||
mt(
|
mt(
|
||||||
'setup',
|
'setup',
|
||||||
@ -477,6 +487,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
|
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
|
'existing_php_mod_pdo_mysql',
|
||||||
mt('setup', 'PHP Module: PDO-MySQL'),
|
mt('setup', 'PHP Module: PDO-MySQL'),
|
||||||
mt(
|
mt(
|
||||||
'setup',
|
'setup',
|
||||||
@ -489,6 +500,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
|
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
|
'existing_php_mod_pdo_pgsql',
|
||||||
mt('setup', 'PHP Module: PDO-PostgreSQL'),
|
mt('setup', 'PHP Module: PDO-PostgreSQL'),
|
||||||
mt(
|
mt(
|
||||||
'setup',
|
'setup',
|
||||||
@ -503,6 +515,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
|
|
||||||
$mysqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Mysql');
|
$mysqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Mysql');
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
|
'existing_class_Zend_Db_Adapter_Pdo_Mysql',
|
||||||
mt('setup', 'Zend Database Adapter For MySQL'),
|
mt('setup', 'Zend Database Adapter For MySQL'),
|
||||||
mt('setup', 'The Zend database adapter for MySQL is required to access a MySQL database.'),
|
mt('setup', 'The Zend database adapter for MySQL is required to access a MySQL database.'),
|
||||||
$mysqlAdapterFound,
|
$mysqlAdapterFound,
|
||||||
@ -513,6 +526,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
|
|
||||||
$pgsqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Pgsql');
|
$pgsqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Pgsql');
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
|
'existing_class_Zend_Db_Adapter_Pdo_Pgsql',
|
||||||
mt('setup', 'Zend Database Adapter For PostgreSQL'),
|
mt('setup', 'Zend Database Adapter For PostgreSQL'),
|
||||||
mt('setup', 'The Zend database adapter for PostgreSQL is required to access a PostgreSQL database.'),
|
mt('setup', 'The Zend database adapter for PostgreSQL is required to access a PostgreSQL database.'),
|
||||||
$pgsqlAdapterFound,
|
$pgsqlAdapterFound,
|
||||||
@ -523,6 +537,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
|
|
||||||
$configDir = Icinga::app()->getConfigDir();
|
$configDir = Icinga::app()->getConfigDir();
|
||||||
$requirements->addMandatory(
|
$requirements->addMandatory(
|
||||||
|
'writable_directory_' . $configDir,
|
||||||
mt('setup', 'Writable Config Directory'),
|
mt('setup', 'Writable Config Directory'),
|
||||||
mt(
|
mt(
|
||||||
'setup',
|
'setup',
|
||||||
@ -539,8 +554,6 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ($this->getWizards() as $wizard) {
|
foreach ($this->getWizards() as $wizard) {
|
||||||
// TODO(8191): Ensure that equal requirements are not shown individually but only
|
|
||||||
// once with their description properly being merged together!
|
|
||||||
$requirements->merge($wizard->getRequirements());
|
$requirements->merge($wizard->getRequirements());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,6 +176,12 @@
|
|||||||
margin: 0 1em 0 0;
|
margin: 0 1em 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
margin: 0;
|
||||||
|
padding-left: 1em;
|
||||||
|
list-style-type: square;
|
||||||
|
}
|
||||||
|
|
||||||
&.state {
|
&.state {
|
||||||
color: white;
|
color: white;
|
||||||
padding: 0.4em;
|
padding: 0.4em;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user