check history db mysql version in update

This commit is contained in:
alejandro.campos@artica.es 2024-03-19 16:52:09 +01:00
parent a31f96314f
commit 7797bef59a
2 changed files with 40 additions and 0 deletions

View File

@ -3,3 +3,4 @@
// Versions must be specified as a string in the following formats: '8', '8.0.30', ...
$php_version = '8.2';
$mysql_version = '8';
$mysql_version_history = '8';

View File

@ -1498,6 +1498,45 @@ class Client
if ($filepath !== null) {
include $filepath;
if ((bool) $config['history_db_enabled'] === true) {
if (isset($config['history_db_connection']) === false
|| $config['history_db_connection'] === false
) {
ob_start();
$config['history_db_connection'] = db_connect(
$config['history_db_host'],
$config['history_db_name'],
$config['history_db_user'],
io_output_password($config['history_db_pass']),
$config['history_db_port'],
false
);
ob_get_clean();
}
if ($config['history_db_connection'] !== false) {
$curr_mysql_version_hist = @mysql_db_process_sql(
'SELECT VERSION() AS version',
'affected_rows',
$config['history_db_connection'],
false
);
$curr_mysql_version_hist = $curr_mysql_version_hist[0]['version'];
if (is_string($curr_mysql_version_hist) === true
&& empty($curr_mysql_version_hist) === false
) {
if (isset($mysql_version_history) === true
&& is_string($mysql_version_history) === true
&& $this->compareVersions($curr_mysql_version_hist, $mysql_version_history) < 0
) {
throw new \Exception('MySQL version (history database) >= '.$mysql_version_history.' is required');
}
}
}
}
$curr_php_version = phpversion();
$curr_mysql_version = db_get_value_sql('SELECT VERSION() AS version');