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

Commit fbc4922

Browse files
tuntojakdureta-launois
authored
chore(release): merge hotfix-mon-15318 in 22.04.x (Centreon WEB 22.04.7) (#11982)
* chore(install): update version to 22.04.7 in insertBaseConf * fixed issue with negative notification_numbers during update (#11936) Co-authored-by: dmyios <[email protected]> Refs: MON-15318 * Add update 22.04.7 php file * enh(auth): autologin enhancement (#11956) Refs: MON-15384 * fix(upgrade) migration to unifiedsql ouput in broker conf (#11951) (#11960) Co-authored-by: Kevin Duret <[email protected]> Co-authored-by: alaunois <[email protected]>
1 parent 94e15aa commit fbc4922

5 files changed

+38
-2
lines changed

www/class/centreonAuth.class.php

+8
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ protected function checkPassword($password, $token = "", $autoImport = false)
202202
*/
203203
private function checkAutologinKey($password, $token): void
204204
{
205+
if (
206+
array_key_exists('contact_oreon', $this->userInfos)
207+
&& $this->userInfos['contact_oreon'] !== '1'
208+
) {
209+
$this->passwdOk = self::PASSWORD_INVALID;
210+
return;
211+
}
212+
205213
if (
206214
!empty($this->userInfos["contact_autologin_key"])
207215
&& $this->userInfos["contact_autologin_key"] === $token

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', '22.04.6');
5+
INSERT INTO `informations` (`key` ,`value`) VALUES ('version', '22.04.7');
66

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

www/install/php/Update-22.04.0-beta.1.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ function migrateBrokerConfigOutputsToUnifiedSql(CentreonDB $pearDB): void
539539
AND config_value IN ($blockIdBinds)");
540540
$grpIdStatement->bindValue(':configId', (int) $configId, PDO::PARAM_INT);
541541
foreach ($blockIdsQueryBinds as $key => $value) {
542-
$grpIdStatement->bindValue($key, (int) $value, PDO::PARAM_INT);
542+
$grpIdStatement->bindValue($key, $value, PDO::PARAM_STR);
543543
}
544544
$grpIdStatement->execute();
545545
$configGroupIds = $grpIdStatement->fetchAll(\PDO::FETCH_COLUMN, 0);

www/install/php/Update-22.04.6.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-22.04.7.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)