From f7cf115f0741193c67de4884cd42b7d14c5c65d1 Mon Sep 17 00:00:00 2001 From: darode Date: Fri, 8 Jun 2012 14:14:40 +0000 Subject: [PATCH] 2012-06-08 Dario Rodriguez * operation/tree.php: Improved performance of tree view for policies. MERGED FROM 4.0.2 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6462 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 +++++++ pandora_console/operation/tree.php | 32 ++++-------------------------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 89eb5d2ba9..d5ff1e36e6 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2012-06-08 Dario Rodriguez + + * operation/tree.php: Improved performance of tree + view for policies. + + MERGED FROM 4.0.2 + 2012-06-08 Ramon Novoa * include/db/postgresql.php, diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php index c5f8377a7e..debd72c8eb 100644 --- a/pandora_console/operation/tree.php +++ b/pandora_console/operation/tree.php @@ -824,34 +824,10 @@ function printTree_($type) { case 'policies': $id = $item['id']; $name = $item['name']; - $agentes = db_get_all_rows_sql("SELECT id_agente FROM tagente - WHERE id_agente IN (SELECT id_agent FROM tpolicy_agents - WHERE id_policy=$id)"); - if ($agentes === false) { - $agentes = array(); - } - $num_ok = 0; - $num_critical = 0; - $num_warning = 0; - $num_unknown = 0; - foreach ($agentes as $agente) { - $stat = reporting_get_agent_module_info ($agente["id_agente"]); - - switch ($stat['status']) { - case 'agent_ok.png': - $num_ok++; - break; - case 'agent_critical.png': - $num_critical++; - break; - case 'agent_warning.png': - $num_warning++; - break; - case 'agent_down.png': - $num_unknown++; - break; - } - } + $num_ok = policies_agents_ok($id); + $num_critical = policies_agents_critical($id); + $num_warning = policies_agents_warning($id); + $num_unknown = policies_agents_unknown($id); break; case 'module': $id = str_replace(array(' ','#'), array('_articapandora_'.ord(' ').'_pandoraartica_', '_articapandora_'.ord('#').'_pandoraartica_'),io_safe_output($item['nombre']));