Private GIT

Skip to content
Snippets Groups Projects
Commit e75ea6a5 authored by Lionel Assepo's avatar Lionel Assepo
Browse files

fix(acl): Add primary key and handle duplicate entries in centreon_acl

parent dcd7d12f
No related branches found
No related tags found
No related merge requests found
......@@ -585,7 +585,8 @@ try {
$str .= "('" . $id_tmp[0] . "' , '" . $id_tmp[1] . "' , " . $acl_group_id . ") ";
$i++;
if ($i >= 1000) {
$pearDBO->query($strBegin . $str);
$strEnd = " ON DUPLICATE KEY UPDATE `group_id` = $acl_group_id";
$pearDBO->query($strBegin . $str . $strEnd);
$str = "";
$i = 0;
}
......@@ -596,7 +597,8 @@ try {
* Insert datas
*/
if ($str != "") {
$pearDBO->query($strBegin . $str);
$strEnd = " ON DUPLICATE KEY UPDATE `group_id` = $acl_group_id";
$pearDBO->query($strBegin . $str . $strEnd);
$str = "";
}
}
......
......@@ -15,7 +15,7 @@ CREATE TABLE `centreon_acl` (
`host_id` int(11) DEFAULT NULL,
`service_id` int(11) DEFAULT NULL,
`group_id` int(11) DEFAULT NULL,
KEY `index1` (`group_id`,`host_id`,`service_id`)
PRIMARY KEY (`group_id`,`host_id`,`service_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment