Fixed the connection to node in metaconsole when show the data module dialog. TICKET: #1870

This commit is contained in:
mdtrooper 2015-03-02 11:40:45 +01:00
parent 4aa7c9eab0
commit eea8e0d8ae
2 changed files with 10 additions and 7 deletions

View File

@ -85,9 +85,10 @@ if ($get_module_detail) {
if (defined ('METACONSOLE')) { if (defined ('METACONSOLE')) {
$server = metaconsole_get_connection ($server_name); $server = metaconsole_get_connection ($server_name);
$conexion = mysql_connect ($server['dbhost'], $server['dbuser'],
$server['dbpass']); if (metaconsole_connect($server) != NOERR)
$select_db = mysql_select_db ($server['dbname'], $conexion); return;
$conexion = false;
} }
else { else {
$conexion = false; $conexion = false;

View File

@ -1553,7 +1553,9 @@ function modules_get_next_data ($id_agent_module, $utimestamp = 0, $string = 0)
* *
* @return array The module value and the timestamp * @return array The module value and the timestamp
*/ */
function modules_get_agentmodule_data ($id_agent_module, $period, $date = 0, $trash=false, $conexion = false, $order = 'ASC') { function modules_get_agentmodule_data ($id_agent_module, $period,
$date = 0, $trash=false, $conexion = false, $order = 'ASC') {
$module = db_get_row('tagente_modulo', 'id_agente_modulo', $module = db_get_row('tagente_modulo', 'id_agente_modulo',
$id_agent_module); $id_agent_module);
@ -1578,7 +1580,7 @@ function modules_get_agentmodule_data ($id_agent_module, $period, $date = 0, $tr
WHERE id_agente_modulo = %d WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %d AND utimestamp > %d AND utimestamp <= %d
ORDER BY utimestamp %s", ORDER BY utimestamp %s",
$id_agent_module, $datelimit, $date, $order); $id_agent_module, $datelimit, $date, $order);
break; break;
//log4x //log4x
case 24: case 24:
@ -1587,7 +1589,7 @@ function modules_get_agentmodule_data ($id_agent_module, $period, $date = 0, $tr
WHERE id_agente_modulo = %d WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %d AND utimestamp > %d AND utimestamp <= %d
ORDER BY utimestamp %s", ORDER BY utimestamp %s",
$id_agent_module, $datelimit, $date, $order); $id_agent_module, $datelimit, $date, $order);
break; break;
default: default:
$sql = sprintf ("SELECT datos AS data, utimestamp $sql = sprintf ("SELECT datos AS data, utimestamp
@ -1595,7 +1597,7 @@ function modules_get_agentmodule_data ($id_agent_module, $period, $date = 0, $tr
WHERE id_agente_modulo = %d WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %d AND utimestamp > %d AND utimestamp <= %d
ORDER BY utimestamp %s", ORDER BY utimestamp %s",
$id_agent_module, $datelimit, $date, $order); $id_agent_module, $datelimit, $date, $order);
break; break;
} }