From e01a703337010b527f5a41b8cf489d7df9ca97cc Mon Sep 17 00:00:00 2001
From: David Boucher <boudav@gmail.com>
Date: Fri, 4 May 2018 10:31:59 +0200
Subject: [PATCH] fix(centAcl.php): Dead code removed (#6262)

* fix(centAcl.php): Dead code removed

The SQL query is simplified a little and all a string affectation
is removed, because done for nothing...
$hostNameCache is no more used.
---
 cron/centAcl.php | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/cron/centAcl.php b/cron/centAcl.php
index de3d0a34e3..a1b910dbd0 100644
--- a/cron/centAcl.php
+++ b/cron/centAcl.php
@@ -225,8 +225,7 @@ try {
      */
 
     $tabGroups = array();
-    $groupStr = "";
-    $query = "SELECT DISTINCT acl_groups.acl_group_id, acl_resources.acl_res_id " .
+    $query = "SELECT DISTINCT acl_groups.acl_group_id " .
         "FROM acl_res_group_relations, `acl_groups`, `acl_resources` " .
         "WHERE acl_groups.acl_group_id = acl_res_group_relations.acl_group_id " .
         "AND acl_res_group_relations.acl_res_id = acl_resources.acl_res_id " .
@@ -236,11 +235,7 @@ try {
 
     $DBRESULT1 = $pearDB->query($query);
     while ($result = $DBRESULT1->fetchRow()) {
-        $tabGroups[$result["acl_group_id"]] = 1;
-        if ($groupStr != '') {
-            $groupStr .= ",";
-        }
-        $groupStr = $result["acl_group_id"];
+        $tabGroups[$result['acl_group_id']] = 1;
     }
     $DBRESULT1->free();
     unset($result);
@@ -263,11 +258,9 @@ try {
         $res->free();
         
         $hostCache = array();
-        $hostNameCache = array();
         $DBRESULT = $pearDB->query("SELECT host_id, host_name FROM host WHERE host_register = '1'");
         while ($h = $DBRESULT->fetchRow()) {
             $hostCache[$h["host_id"]] = $h["host_name"];
-            $hostNameCache[$h["host_name"]] = $h["host_id"];
         }
         $DBRESULT->free();
         unset($h);
-- 
GitLab