Skip to content
This repository was archived by the owner on Dec 13, 2022. It is now read-only.

Commit a487b58

Browse files
tuntojakduret
andauthored
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 <[email protected]> Refs: MON-15318 * add php update file for 21.10.12 Co-authored-by: Kevin Duret <[email protected]>
1 parent 59a70af commit a487b58

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

www/install/insertBaseConf.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- Insert version
33
--
44

5-
INSERT INTO `informations` (`key` ,`value`) VALUES ('version', '21.10.11');
5+
INSERT INTO `informations` (`key` ,`value`) VALUES ('version', '21.10.12');
66

77
--
88
-- Contenu de la table `contact`

www/install/php/Update-21.10.11.php

+8
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,22 @@
2929
try {
3030
$errorMessage = "Impossible to update 'hosts' table";
3131
if (! str_contains(strtolower($pearDBO->getColumnType('hosts', 'notification_number')), 'bigint')) {
32+
$pearDBO->beginTransaction();
33+
$pearDBO->query("UPDATE `hosts` SET `notification_number`= 0 WHERE `notification_number`< 0");
3234
$pearDBO->query("ALTER TABLE `hosts` MODIFY `notification_number` BIGINT(20) UNSIGNED DEFAULT NULL");
3335
}
3436

3537
$errorMessage = "Impossible to update 'services' table";
3638
if (! str_contains(strtolower($pearDBO->getColumnType('services', 'notification_number')), 'bigint')) {
39+
$pearDBO->beginTransaction();
40+
$pearDBO->query("UPDATE `services` SET `notification_number`= 0 WHERE `notification_number`< 0");
3741
$pearDBO->query("ALTER TABLE `services` MODIFY `notification_number` BIGINT(20) UNSIGNED DEFAULT NULL");
3842
}
3943
} catch (\Exception $e) {
44+
if ($pearDBO->inTransaction()) {
45+
$pearDBO->rollBack();
46+
}
47+
4048
$centreonLog->insertLog(
4149
4,
4250
$versionOfTheUpgrade . $errorMessage .

www/install/php/Update-21.10.12.php

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
/*
4+
* Copyright 2005 - 2022 Centreon (https://www.centreon.com/)
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* For more information : [email protected]
19+
*
20+
*/

0 commit comments

Comments
 (0)