From 4ecf81d032e2f0761cc80ec8c686bb860a01b9db Mon Sep 17 00:00:00 2001 From: Anne-Cath Date: Fri, 27 Feb 2026 16:36:18 +0100 Subject: [PATCH 1/3] =?UTF-8?q?N=C2=B07150=20-=20Backup=20:=20on=20MariaDB?= =?UTF-8?q?=20>=3D=2011.0.1=20call=20mariadb-dump=20instead=20of=20mysqldu?= =?UTF-8?q?mp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- datamodels/2.x/itop-backup/status.php | 2 +- setup/backup.class.inc.php | 12 +++++++++++- setup/setuputils.class.inc.php | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/datamodels/2.x/itop-backup/status.php b/datamodels/2.x/itop-backup/status.php index 5eead230dc..d3bf6cef7c 100644 --- a/datamodels/2.x/itop-backup/status.php +++ b/datamodels/2.x/itop-backup/status.php @@ -96,7 +96,7 @@ function GenerateBackupsList(string $sListTitleDictKey, string $sNoRecordDictKey // $sMySQLBinDir = MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'mysql_bindir', ''); $sMySQLBinDir = utils::ReadParam('mysql_bindir', $sMySQLBinDir, true); - $sMySQLDump = DBBackup::MakeSafeMySQLCommand($sMySQLBinDir, 'mysqldump'); + $sMySQLDump = DBBackup::MakeSafeMySQLCommand($sMySQLBinDir, DBBackup::GetDumpFunction()); $sCommand = "$sMySQLDump -V 2>&1"; $aOutput = []; diff --git a/setup/backup.class.inc.php b/setup/backup.class.inc.php index f1609791be..4a89c3f248 100644 --- a/setup/backup.class.inc.php +++ b/setup/backup.class.inc.php @@ -346,7 +346,7 @@ public function DoBackup($sBackupFileName) $this->LogInfo("Starting backup of $this->sDBHost/$this->sDBName(suffix:'$this->sDBSubName')"); $sMySQLBinDir = utils::ReadParam('mysql_bindir', $this->sMySQLBinDir, true); - $sMySQLDump = $this->MakeSafeMySQLCommand($sMySQLBinDir, 'mysqldump'); + $sMySQLDump = $this->MakeSafeMySQLCommand($sMySQLBinDir, DBBackup::GetDumpFunction()); // Store the results in a temporary file $sTmpFileName = self::EscapeShellArg($sBackupFileName); @@ -603,6 +603,16 @@ public static function MakeSafeMySQLCommand($sMySQLBinDir, string $sCmd) return '"'.$sMySQLCommand.'"'; } + + public static function GetDumpFunction(): string + { + $version = CMDBSource::QueryToScalar('SELECT VERSION()'); + if (is_string($version) && stripos($version, 'MariaDB') !== false) { + return 'mariadb-dump'; + } + + return 'mysqldump'; + } } class TarGzArchive implements BackupArchive diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index d04c920df1..c019dfe04b 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -564,7 +564,7 @@ public static function CheckBackupPrerequisites($sDBBackupPath, $sMySQLBinDir = $sMySQLBinDir = MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'mysql_bindir', ''); } try { - $sMySQLDump = DBBackup::MakeSafeMySQLCommand($sMySQLBinDir, 'mysqldump'); + $sMySQLDump = DBBackup::MakeSafeMySQLCommand($sMySQLBinDir, DBBackup::GetDumpFunction()); } catch (Exception $e) { $aResult[] = new CheckResult(CheckResult::ERROR, $e->getMessage()); return $aResult; From 7f24bcedd82c32a79e1e28053c72e71cb6008a64 Mon Sep 17 00:00:00 2001 From: Anne-Cath Date: Fri, 27 Feb 2026 17:24:31 +0100 Subject: [PATCH 2/3] =?UTF-8?q?N=C2=B07150=20-=20Backup=20:=20on=20MariaDB?= =?UTF-8?q?=20>=3D=2011.0.1=20call=20mariadb-dump=20instead=20of=20mysqldu?= =?UTF-8?q?mp=20-=20fix=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/setuputils.class.inc.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index c019dfe04b..cebe1563b2 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -559,11 +559,14 @@ public static function CheckBackupPrerequisites($sDBBackupPath, $sMySQLBinDir = $aResult[] = new CheckResult(CheckResult::ERROR, "The PHP exec() function has been disabled on this server"); } + MetaModel::LoadConfig(utils::GetConfig()); // availability of mysqldump if (empty($sMySQLBinDir) && null != MetaModel::GetConfig()) { $sMySQLBinDir = MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'mysql_bindir', ''); } try { + $oConfig = MetaModel::GetConfig(); + CMDBSource::InitFromConfig($oConfig); $sMySQLDump = DBBackup::MakeSafeMySQLCommand($sMySQLBinDir, DBBackup::GetDumpFunction()); } catch (Exception $e) { $aResult[] = new CheckResult(CheckResult::ERROR, $e->getMessage()); From 3c01bd2924d1343258e19d2a73e9b562d22c25c5 Mon Sep 17 00:00:00 2001 From: Anne-Catherine <57360138+accognet@users.noreply.github.com> Date: Mon, 2 Mar 2026 15:53:37 +0100 Subject: [PATCH 3/3] Update setup/backup.class.inc.php Co-authored-by: Thomas Casteleyn --- setup/backup.class.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/backup.class.inc.php b/setup/backup.class.inc.php index 4a89c3f248..c1807d8264 100644 --- a/setup/backup.class.inc.php +++ b/setup/backup.class.inc.php @@ -606,8 +606,8 @@ public static function MakeSafeMySQLCommand($sMySQLBinDir, string $sCmd) public static function GetDumpFunction(): string { - $version = CMDBSource::QueryToScalar('SELECT VERSION()'); - if (is_string($version) && stripos($version, 'MariaDB') !== false) { + $sVersion = CMDBSource::GetDBVersion(); + if (stripos($sVersion, 'MariaDB') !== false) { return 'mariadb-dump'; }