1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-01-09 14:14:10 +01:00

Aggiunto controllo MySQL per i requisiti

This commit is contained in:
Luca 2022-02-07 14:41:06 +01:00
parent d918c1e763
commit 0440d6cc77

View File

@ -47,10 +47,10 @@ foreach ($modules as $name => $values) {
$settings = [
'php_version' => [
'type' => 'php',
'description' => '7.4 - 8.0',
'minimum' => '7.4',
'maximum' => '8.0',
'type' => 'version',
'description' => '7.4.x - 8.0.x',
'minimum' => '7.4.0',
'maximum' => '8.0.15',
],
'zip' => [
@ -113,14 +113,14 @@ $php = [];
foreach ($settings as $name => $values) {
$description = $values['description'];
if ($values['type'] == 'php') {
if ($values['type'] == 'version') {
$description = tr('Valore consigliato: _VALUE_ (Valore attuale: _PHP_VERSION_)', [
'_VALUE_' => $description,
'_PHP_VERSION_' => phpversion(),
]);
$status = (version_compare(phpversion(), $values['minimum']) < 0 || (version_compare(phpversion(), $values['maximum']) > 0) ? 0 : 1);
$status = ((version_compare(phpversion(), $values['minimum'], ">=") && version_compare(phpversion(), $values['maximum'], "<=")) ? 1 : 0);
} elseif ($values['type'] == 'ext') {
$status = extension_loaded($name);
@ -150,6 +150,14 @@ foreach ($settings as $name => $values) {
$type = ($values['type'] == 'ext') ? tr('Estensione') : tr('Impostazione');
if ($values['type'] == 'ext'){
$type = tr('Estensione');
}elseif ($values['type'] == 'version') {
$type = tr('Versione');
}else{
$type = tr('Impostazione');
}
$php[] = [
'name' => $name,
'description' => $description,
@ -158,6 +166,36 @@ foreach ($settings as $name => $values) {
];
}
// MySQL
$db = [
'mysql_version' => [
'type' => 'mysql',
'description' => '5.7.x - 8.0.x',
'minimum' => '5.7.0',
'maximum' => '8.0.27',
],
];
foreach ($db as $name => $values) {
$description = $values['description'];
$description = tr('Valore consigliato: _VALUE_ (Valore attuale: _MYSQL_VERSION_)', [
'_VALUE_' => $description,
'_MYSQL_VERSION_' => $database->getMySQLVersion(),
]);
$status = ((version_compare($database->getMySQLVersion(), $values['minimum'], ">=") && version_compare($database->getMySQLVersion(), $values['maximum'], "<=")) ? 1 : 0);
$mysql[] = [
'name' => $name,
'description' => $description,
'status' => $status,
'type' => tr('Versione'),
];
}
// Percorsi di servizio
$dirs = [
'backup' => tr('Necessario per il salvataggio dei backup'),
@ -181,8 +219,9 @@ $requirements = [
tr('Apache') => $apache,
tr('PHP (_VERSION_ _SUPPORTED_)', [
'_VERSION_' => phpversion(),
'_SUPPORTED_' => (version_compare(phpversion(), $settings['php_version']['minimum']) < 0 || (version_compare(phpversion(), $settings['php_version']['maximum']) > 0) ? '<small><small class="label label-danger" ><i class="fa fa-warning"></i> '.tr('versioni supportate:').' '.$settings['php_version']['minimum'].' - '.$settings['php_version']['maximum'].'</small></small>' : '' )
'_SUPPORTED_' => ( ( version_compare(phpversion(), $settings['php_version']['minimum'], ">=") && version_compare(phpversion(), $settings['php_version']['maximum'], "<=") ) ? '' : '<small><small class="label label-danger" ><i class="fa fa-warning"></i> '.tr('versioni supportate:').' '.$settings['php_version']['description'].'</small></small>')
]) => $php,
tr('MySQL') => $mysql,
tr('Percorsi di servizio') => $directories,
];