diff --git a/www/api/class/centreon_performance_service.class.php b/www/api/class/centreon_performance_service.class.php index 15446f21782..5a4728a5617 100644 --- a/www/api/class/centreon_performance_service.class.php +++ b/www/api/class/centreon_performance_service.class.php @@ -114,7 +114,8 @@ public function getList() } if ($excludeAnomalyDetection) { - $additionalCondition .= 'AND s.service_id NOT IN (SELECT service_id FROM ' . $conf_centreon['db'] . '.mod_anomaly_service) '; + $additionalCondition .= 'AND s.service_id NOT IN (SELECT service_id + FROM `' . $conf_centreon['db'] . '`.mod_anomaly_service) '; } if (isset($this->arguments['hostgroup'])) { $additionalCondition .= 'AND (hg.host_id = i.host_id ' . diff --git a/www/api/class/centreon_topcounter.class.php b/www/api/class/centreon_topcounter.class.php index f4754d00257..3c492b79598 100644 --- a/www/api/class/centreon_topcounter.class.php +++ b/www/api/class/centreon_topcounter.class.php @@ -878,19 +878,20 @@ protected function checkChangeState($pollerId, $lastRestart) $query = "SELECT * FROM log_action WHERE action_log_date > $lastRestart " . "AND ((object_type = 'host' AND ((action_type = 'd' AND object_id IN (SELECT host_id FROM hosts)) " . - "OR object_id IN (SELECT host_host_id FROM " . - $conf_centreon['db'] . ".ns_host_relation WHERE nagios_server_id = '$pollerId'))) " . + "OR object_id IN (SELECT host_host_id FROM `" . + $conf_centreon['db'] . "`.ns_host_relation WHERE nagios_server_id = '$pollerId'))) " . "OR (object_type = 'service' AND ((action_type = 'd' AND object_id IN (SELECT service_id FROM services)) OR " . - "object_id IN (SELECT service_service_id FROM " . - $conf_centreon['db'] . ".ns_host_relation nhr, " . $conf_centreon['db'] . ".host_service_relation hsr " . + "object_id IN (SELECT service_service_id FROM `" . + $conf_centreon['db'] . "`.ns_host_relation nhr, `" . $conf_centreon['db'] . "`.host_service_relation hsr " . "WHERE nagios_server_id = '$pollerId' AND hsr.host_host_id = nhr.host_host_id)))" . "OR (object_type = 'servicegroup' AND ((action_type = 'd' AND object_id IN (SELECT DISTINCT servicegroup_id " . - "FROM services_servicegroups)) OR object_id IN (SELECT DISTINCT servicegroup_sg_id FROM " . - $conf_centreon['db'] . ".servicegroup_relation sgr, " . $conf_centreon['db'] . ".ns_host_relation nhr " . + "FROM services_servicegroups)) OR object_id IN (SELECT DISTINCT servicegroup_sg_id FROM `" . + $conf_centreon['db'] . "`.servicegroup_relation sgr, + `" . $conf_centreon['db'] . "`.ns_host_relation nhr " . "WHERE sgr.host_host_id = nhr.host_host_id AND nhr.nagios_server_id = '$pollerId')))" . "OR (object_type = 'hostgroup' AND ((action_type = 'd' AND object_id IN (SELECT DISTINCT hostgroup_id " . - "FROM hosts_hostgroups)) OR object_id IN (SELECT DISTINCT hr.hostgroup_hg_id FROM " . - $conf_centreon['db'] . ".hostgroup_relation hr, " . $conf_centreon['db'] . ".ns_host_relation nhr " . + "FROM hosts_hostgroups)) OR object_id IN (SELECT DISTINCT hr.hostgroup_hg_id FROM `" . + $conf_centreon['db'] . "`.hostgroup_relation hr, `" . $conf_centreon['db'] . "`.ns_host_relation nhr " . "WHERE hr.host_host_id = nhr.host_host_id AND nhr.nagios_server_id = '$pollerId'))))"; try { diff --git a/www/include/configuration/configServers/DB-Func.php b/www/include/configuration/configServers/DB-Func.php index 28a40f42338..ab1a575f7dc 100644 --- a/www/include/configuration/configServers/DB-Func.php +++ b/www/include/configuration/configServers/DB-Func.php @@ -1068,7 +1068,7 @@ function getChangeState(array $pollers): array UNION SELECT instance_id, COUNT(*) as num_logs, MAX(action_log_date) as action_log_date FROM log_action INNER JOIN ( - SELECT nagios_server_id as instance_id, host_host_id as host_id FROM {$conf_centreon['db']}.ns_host_relation + SELECT nagios_server_id as instance_id, host_host_id as host_id FROM `{$conf_centreon['db']}`.ns_host_relation WHERE nagios_server_id IN ($pollersSearch) ) AS subtable ON log_action.object_id = subtable.host_id WHERE log_action.object_type = 'host' AND action_log_date > $lastRestart GROUP BY subtable.instance_id @@ -1084,7 +1084,7 @@ function getChangeState(array $pollers): array SELECT instance_id, COUNT(*) as num_logs, MAX(action_log_date) as action_log_date FROM log_action INNER JOIN ( SELECT nagios_server_id as instance_id, service_service_id as service_id - FROM {$conf_centreon['db']}.ns_host_relation nhr, {$conf_centreon['db']}.host_service_relation hsr + FROM `{$conf_centreon['db']}`.ns_host_relation nhr, `{$conf_centreon['db']}`.host_service_relation hsr WHERE nagios_server_id IN ($pollersSearch) AND hsr.host_host_id = nhr.host_host_id ) AS subtable ON log_action.object_id = subtable.service_id @@ -1101,7 +1101,7 @@ function getChangeState(array $pollers): array SELECT instance_id, COUNT(*) as num_logs, MAX(action_log_date) as action_log_date FROM log_action INNER JOIN ( SELECT nhr.nagios_server_id as instance_id, servicegroup_sg_id as servicegroup_id - FROM {$conf_centreon['db']}.servicegroup_relation sgr, {$conf_centreon['db']}.ns_host_relation nhr + FROM `{$conf_centreon['db']}`.servicegroup_relation sgr, `{$conf_centreon['db']}`.ns_host_relation nhr WHERE nhr.nagios_server_id IN ($pollersSearch) AND sgr.host_host_id = nhr.host_host_id ) AS subtable ON log_action.object_id = subtable.servicegroup_id @@ -1118,7 +1118,7 @@ function getChangeState(array $pollers): array SELECT instance_id, COUNT(*) as num_logs, MAX(action_log_date) as action_log_date FROM log_action INNER JOIN ( SELECT nhr.nagios_server_id as instance_id, hostgroup_hg_id as hostgroup_id - FROM {$conf_centreon['db']}.hostgroup_relation hr, {$conf_centreon['db']}.ns_host_relation nhr + FROM `{$conf_centreon['db']}`.hostgroup_relation hr, `{$conf_centreon['db']}`.ns_host_relation nhr WHERE nhr.nagios_server_id IN ($pollersSearch) AND hr.host_host_id = nhr.host_host_id ) AS subtable ON log_action.object_id = subtable.hostgroup_id @@ -1178,7 +1178,7 @@ function checkChangeState(int $poller_id, int $last_restart): bool ) OR object_id IN ( SELECT host_host_id - FROM {$conf_centreon['db']}.ns_host_relation + FROM `{$conf_centreon['db']}`.ns_host_relation` WHERE nagios_server_id = $poller_id ) ) @@ -1196,7 +1196,7 @@ function checkChangeState(int $poller_id, int $last_restart): bool ) OR object_id IN ( SELECT service_service_id - FROM {$conf_centreon['db']}.ns_host_relation nhr, {$conf_centreon['db']}.host_service_relation hsr + FROM `{$conf_centreon['db']}`.ns_host_relation nhr, `{$conf_centreon['db']}`.host_service_relation hsr WHERE nagios_server_id = $poller_id AND hsr.host_host_id = nhr.host_host_id ) @@ -1216,7 +1216,7 @@ function checkChangeState(int $poller_id, int $last_restart): bool ) OR object_id IN ( SELECT DISTINCT servicegroup_sg_id - FROM {$conf_centreon['db']}.servicegroup_relation sgr, {$conf_centreon['db']}.ns_host_relation nhr + FROM `{$conf_centreon['db']}`.servicegroup_relation sgr, `{$conf_centreon['db']}`.ns_host_relation nhr WHERE sgr.host_host_id = nhr.host_host_id AND nhr.nagios_server_id = $poller_id ) @@ -1236,7 +1236,7 @@ function checkChangeState(int $poller_id, int $last_restart): bool ) OR object_id IN ( SELECT DISTINCT hr.hostgroup_hg_id - FROM {$conf_centreon['db']}.hostgroup_relation hr, {$conf_centreon['db']}.ns_host_relation nhr + FROM `{$conf_centreon['db']}`.hostgroup_relation hr, `{$conf_centreon['db']}`.ns_host_relation nhr WHERE hr.host_host_id = nhr.host_host_id AND nhr.nagios_server_id = $poller_id )