From f03d731b1dfea6f14cd1e31b340815b3944c2abc Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Wed, 12 Jun 2024 16:14:23 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B07533=20-=20Prevent=20installation=20of?= =?UTF-8?q?=20iTop=20on=20Galera=20clusters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/cmdbsource.class.inc.php | 22 +++++++++++++++++----- setup/setuputils.class.inc.php | 8 ++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/core/cmdbsource.class.inc.php b/core/cmdbsource.class.inc.php index e65496cd0..5097c7538 100644 --- a/core/cmdbsource.class.inc.php +++ b/core/cmdbsource.class.inc.php @@ -95,7 +95,7 @@ class MySQLHasGoneAwayException extends MySQLException { return array( 2006, - 2013 + 2013, ); } @@ -1296,8 +1296,8 @@ class CMDBSource */ public static function IsSameFieldTypes($sItopGeneratedFieldType, $sDbFieldType) { - list($sItopFieldDataType, $sItopFieldTypeOptions, $sItopFieldOtherOptions) = static::GetFieldDataTypeAndOptions($sItopGeneratedFieldType); - list($sDbFieldDataType, $sDbFieldTypeOptions, $sDbFieldOtherOptions) = static::GetFieldDataTypeAndOptions($sDbFieldType); + [$sItopFieldDataType, $sItopFieldTypeOptions, $sItopFieldOtherOptions] = static::GetFieldDataTypeAndOptions($sItopGeneratedFieldType); + [$sDbFieldDataType, $sDbFieldTypeOptions, $sDbFieldOtherOptions] = static::GetFieldDataTypeAndOptions($sDbFieldType); if (strcasecmp($sItopFieldDataType, $sDbFieldDataType) !== 0) { @@ -1734,8 +1734,20 @@ class CMDBSource return false; } - /** - * @return string query to upgrade database charset and collation if needed, null if not + public static function GetClusterNb() + { + $result = 0; + $sSql = "SHOW STATUS LIKE 'wsrep_cluster_size';"; + $aRows = self::QueryToArray($sSql); + if (count($aRows) > 0) + { + $result = $aRows[0]['Value']; + } + return intval($result); + } + + /** + * @return string query to upgrade database charset and collation if needed, null if not * @throws \MySQLException * * @since 2.5.0 N°1001 switch to utf8mb4 diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index 329a6b9f8..318dbc6ad 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -1230,6 +1230,12 @@ EOF $aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_connections is set to $iMaxConnections."); } + $iClusters = $oDBSource->GetClusterNb(); + if ($iClusters > 0) { + SetupLog::Warning('Warning - Galera can lead to malfunctions and data corruption. Combodo does not support this type of infrastructure.'); + $aResult['checks'][] = new CheckResult(CheckResult::WARNING, 'Galera can lead to malfunctions and data corruption. Combodo does not support this type of infrastructure.'); + } + try { $aResult['databases'] = $oDBSource->ListDB(); } @@ -1345,6 +1351,8 @@ EOF static public function AsyncCheckDB($oPage, $aParameters) { + SetupPage::log('Info - CheckDB'); + $sDBServer = $aParameters['db_server']; $sDBUser = $aParameters['db_user']; $sDBPwd = $aParameters['db_pwd'];