Skip to content

Commit dd50650

Browse files
committed
Add MySQL version check in installer and updater.
1 parent 7c43aab commit dd50650

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

install/install.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@
252252
include_once 'lib/mysql.lib.php';
253253
$inst->db = new db();
254254

255+
//* Check MySQL version
256+
$inst->check_mysql_version();
257+
255258
//** Begin with standard or expert installation
256259

257260
$conf['services']['mail'] = false;

install/lib/installer_base.lib.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,29 @@ public function check_prerequisites() {
262262
if($msg != '') die($msg);
263263
}
264264

265+
//** Check MySQL version
266+
public function check_mysql_version() {
267+
global $conf;
268+
269+
$min_mariadb_version = '10.0.5';
270+
$min_mysql_version = '8.0.0';
271+
272+
$rec = $this->db->queryOneRecord('SELECT VERSION() as mysql_version;');
273+
$version = if(is_array($rec))? $rec['mysql_version']: '0';
274+
275+
if(strpos($version,'MariaDB')) {
276+
// We have MariaDB
277+
$parts = explode('-',$version);
278+
$version = $parts[0];
279+
if(version_compare($version, $min_mariadb_version, '<')) die("Minimum required MariaDB version is ".$min_mariadb_version."\n");
280+
} else {
281+
// we have MySQL
282+
if(version_compare($version, $min_mysql_version, '<')) die("Minimum required MySQL version is ".$min_mysql_version."\n");
283+
}
284+
285+
286+
}
287+
265288
public function force_configure_app($service, $enable_force=true) {
266289
$force = false;
267290
if(AUTOINSTALL == true) return false;

install/update.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@
274274
$inst->db->setDBData($conf['mysql']["host"], $conf['mysql']["ispconfig_user"], $conf['mysql']["ispconfig_password"], $conf['mysql']["port"]);
275275
$inst->db->setDBName($conf['mysql']['database']);
276276

277+
//* Check MySQL version
278+
$inst->check_mysql_version();
279+
277280
//* initialize the master DB, if we have a multiserver setup
278281
if($conf['mysql']['master_slave_setup'] == 'y') {
279282

0 commit comments

Comments
 (0)