Aggiunta verifica integrità db per MariaDB 10.x
This commit is contained in:
parent
ccc80f5408
commit
752d4feceb
|
@ -91,8 +91,9 @@ REVISION
|
||||||
.php_cs.cache
|
.php_cs.cache
|
||||||
manifest.json
|
manifest.json
|
||||||
checksum.json
|
checksum.json
|
||||||
database.json
|
mysql.json
|
||||||
database_5_7.json
|
mysql_5_7.json
|
||||||
|
mariadb_10_x.json
|
||||||
settings.json
|
settings.json
|
||||||
|
|
||||||
/tests/_log/*
|
/tests/_log/*
|
||||||
|
|
|
@ -470,8 +470,9 @@ function release(done) {
|
||||||
glob([
|
glob([
|
||||||
'**/*',
|
'**/*',
|
||||||
'!checksum.json',
|
'!checksum.json',
|
||||||
'!database.json',
|
'!mysql.json',
|
||||||
'!database_5_7.json',
|
'!mysql_5_7.json',
|
||||||
|
'!mariadb_10_x.json',
|
||||||
'!settings.json',
|
'!settings.json',
|
||||||
'!manifest.json',
|
'!manifest.json',
|
||||||
'!.idea/**',
|
'!.idea/**',
|
||||||
|
@ -533,7 +534,7 @@ function release(done) {
|
||||||
archive.append(shell.exec('php update/structure.php', {
|
archive.append(shell.exec('php update/structure.php', {
|
||||||
silent: true
|
silent: true
|
||||||
}).stdout, {
|
}).stdout, {
|
||||||
name: 'database.json'
|
name: 'mysql.json'
|
||||||
});
|
});
|
||||||
|
|
||||||
// Aggiunta del file per il controllo delle impostazioni
|
// Aggiunta del file per il controllo delle impostazioni
|
||||||
|
|
|
@ -247,9 +247,9 @@ if ($database->isInstalled()) {
|
||||||
$db = [
|
$db = [
|
||||||
'mysql_version' => [
|
'mysql_version' => [
|
||||||
'type' => 'version',
|
'type' => 'version',
|
||||||
'description' => '5.7.x - 8.0.x',
|
'description' => (($database->isMySQL)? '5.7.x - 8.0.x' : '10.x'),
|
||||||
'minimum' => '5.7.0',
|
'minimum' => (($database->isMySQL)? '5.7.0' : '10.1.0'),
|
||||||
'maximum' => '8.0.99',
|
'maximum' => (($database->isMySQL)? '8.0.99' : '10.6.99'),
|
||||||
],
|
],
|
||||||
|
|
||||||
'sort_buffer_size' => [
|
'sort_buffer_size' => [
|
||||||
|
@ -355,8 +355,9 @@ foreach ($dirs_to_check as $name => $description) {
|
||||||
// File di servizio
|
// File di servizio
|
||||||
$files_to_check = [
|
$files_to_check = [
|
||||||
'manifest.json' => tr('Necessario per l\'aggiunta a schermata home da terminale (creato al termine della configurazione)'),
|
'manifest.json' => tr('Necessario per l\'aggiunta a schermata home da terminale (creato al termine della configurazione)'),
|
||||||
'database_5_7.json' => tr('Necessario per il controllo integrità con database MySQL 5.7.x'),
|
'mariadb_10_x.json' => tr('Necessario per il controllo integrità con database MariaDB 10.x'),
|
||||||
'database.json' => tr('Necessario per il controllo integrità con database MySQL 8.0.x'),
|
'mysql_5_7.json' => tr('Necessario per il controllo integrità con database MySQL 5.7.x'),
|
||||||
|
'mysql.json' => tr('Necessario per il controllo integrità con database MySQL 8.0.x'),
|
||||||
'checksum.json' => tr('Necessario per il controllo integrità dei files del gestionale'),
|
'checksum.json' => tr('Necessario per il controllo integrità dei files del gestionale'),
|
||||||
'settings.json' => tr('Necessario per il controllo delle impostazioni del gestionale'),
|
'settings.json' => tr('Necessario per il controllo delle impostazioni del gestionale'),
|
||||||
];
|
];
|
||||||
|
@ -435,7 +436,9 @@ $requirements = [
|
||||||
'_VERSION_' => phpversion(),
|
'_VERSION_' => phpversion(),
|
||||||
'_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>'),
|
'_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,
|
]) => $php,
|
||||||
tr('MySQL') => $mysql,
|
tr('DBMS (_TYPE_)', [
|
||||||
|
'_TYPE_' => $database->getType(),
|
||||||
|
] ) => $mysql,
|
||||||
tr('Percorsi di servizio') => $directories,
|
tr('Percorsi di servizio') => $directories,
|
||||||
tr('File di servizio') => $files,
|
tr('File di servizio') => $files,
|
||||||
tr('Configurazioni') => $config,
|
tr('Configurazioni') => $config,
|
||||||
|
|
|
@ -100,10 +100,20 @@ $(document).ready(function () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mysql_min_version = '5.7.0';
|
switch ($database->getType()) {
|
||||||
$mysql_max_version = '5.7.99';
|
case 'MariaDB':
|
||||||
|
$file_to_check_database = 'mariadb_10_x.json';
|
||||||
|
break;
|
||||||
|
case 'MySQL':
|
||||||
|
$mysql_min_version = '5.7.0';
|
||||||
|
$mysql_max_version = '5.7.99';
|
||||||
|
$file_to_check_database = ((version_compare($database->getMySQLVersion(), $mysql_min_version, '>=') && version_compare($database->getMySQLVersion(), $mysql_max_version, '<=')) ? 'mysql_5_7.json' :'mysql.json');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$file_to_check_database = 'mysql.json';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$contents = ((version_compare($database->getMySQLVersion(), $mysql_min_version, '>=') && version_compare($database->getMySQLVersion(), $mysql_max_version, '<=')) ? $file_to_check_database = 'database_5_7.json' : $file_to_check_database = 'database.json');
|
|
||||||
$contents = file_get_contents(base_dir().'/'.$file_to_check_database);
|
$contents = file_get_contents(base_dir().'/'.$file_to_check_database);
|
||||||
$data = json_decode($contents, true);
|
$data = json_decode($contents, true);
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,39 @@ class Database extends Util\Singleton
|
||||||
return $this->mysql_version;
|
return $this->mysql_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restituisce il tipo di DBMS.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getType()
|
||||||
|
{
|
||||||
|
$ver = $this->fetchArray('SELECT VERSION()');
|
||||||
|
if (preg_match('/MariaDB/', $ver[0]['VERSION()'])) {
|
||||||
|
return 'MariaDB';
|
||||||
|
} else {
|
||||||
|
return 'MySQL';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controlla il tipo se il DBMS è MySQL.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isMySQL()
|
||||||
|
{
|
||||||
|
$ver = $this->fetchArray('SELECT VERSION()');
|
||||||
|
if (preg_match('/MariaDB/', $ver[0]['VERSION()'])) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restituisce il nome del database a cui si è connessi.
|
* Restituisce il nome del database a cui si è connessi.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue