From a487b584e6358a14acceefa156e38d07207eacc8 Mon Sep 17 00:00:00 2001 From: tuntoja <58987095+tuntoja@users.noreply.github.com> Date: Fri, 7 Oct 2022 09:08:39 +0200 Subject: [PATCH] chore(release): merge hotfix-mon-15318 in 21.10.x (#11948) * update version to 21.10.12 in insertBaseConf * fixed issue where notification number < 0 before update (#11935) Co-authored-by: dmyios Refs: MON-15318 * add php update file for 21.10.12 Co-authored-by: Kevin Duret --- www/install/insertBaseConf.sql | 2 +- www/install/php/Update-21.10.11.php | 8 ++++++++ www/install/php/Update-21.10.12.php | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 www/install/php/Update-21.10.12.php diff --git a/www/install/insertBaseConf.sql b/www/install/insertBaseConf.sql index 2da8737b69e..4e9c0e02a30 100644 --- a/www/install/insertBaseConf.sql +++ b/www/install/insertBaseConf.sql @@ -2,7 +2,7 @@ -- Insert version -- -INSERT INTO `informations` (`key` ,`value`) VALUES ('version', '21.10.11'); +INSERT INTO `informations` (`key` ,`value`) VALUES ('version', '21.10.12'); -- -- Contenu de la table `contact` diff --git a/www/install/php/Update-21.10.11.php b/www/install/php/Update-21.10.11.php index c97310ee79a..18765034ac6 100644 --- a/www/install/php/Update-21.10.11.php +++ b/www/install/php/Update-21.10.11.php @@ -29,14 +29,22 @@ try { $errorMessage = "Impossible to update 'hosts' table"; if (! str_contains(strtolower($pearDBO->getColumnType('hosts', 'notification_number')), 'bigint')) { + $pearDBO->beginTransaction(); + $pearDBO->query("UPDATE `hosts` SET `notification_number`= 0 WHERE `notification_number`< 0"); $pearDBO->query("ALTER TABLE `hosts` MODIFY `notification_number` BIGINT(20) UNSIGNED DEFAULT NULL"); } $errorMessage = "Impossible to update 'services' table"; if (! str_contains(strtolower($pearDBO->getColumnType('services', 'notification_number')), 'bigint')) { + $pearDBO->beginTransaction(); + $pearDBO->query("UPDATE `services` SET `notification_number`= 0 WHERE `notification_number`< 0"); $pearDBO->query("ALTER TABLE `services` MODIFY `notification_number` BIGINT(20) UNSIGNED DEFAULT NULL"); } } catch (\Exception $e) { + if ($pearDBO->inTransaction()) { + $pearDBO->rollBack(); + } + $centreonLog->insertLog( 4, $versionOfTheUpgrade . $errorMessage . diff --git a/www/install/php/Update-21.10.12.php b/www/install/php/Update-21.10.12.php new file mode 100644 index 00000000000..8572f2a05df --- /dev/null +++ b/www/install/php/Update-21.10.12.php @@ -0,0 +1,20 @@ +