fixed errors cps in meta and others
This commit is contained in:
parent
0040837f4b
commit
0f9b7d13ee
|
@ -25,16 +25,19 @@ require_once($config['homedir'] . '/include/functions_users.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the agent exists in the DB.
|
* Check the agent exists in the DB.
|
||||||
*
|
*
|
||||||
* @param int $id_agent The agent id.
|
* @param int $id_agent The agent id.
|
||||||
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
|
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
|
||||||
*
|
*
|
||||||
* @return boolean The result to check if the agent is in the DB.
|
* @return boolean The result to check if the agent is in the DB.
|
||||||
*/
|
*/
|
||||||
function agents_check_agent_exists($id_agent, $show_disabled = true) {
|
function agents_check_agent_exists($id_agent, $show_disabled = true) {
|
||||||
$agent = db_get_value_filter('id_agente', 'tagente',
|
$agent = db_get_value_filter(
|
||||||
array('id_agente' => $id_agent, 'disabled' => !$show_disabled));
|
'id_agente',
|
||||||
|
'tagente',
|
||||||
|
array('id_agente' => $id_agent, 'disabled' => !$show_disabled)
|
||||||
|
);
|
||||||
|
|
||||||
if (!empty($agent)) {
|
if (!empty($agent)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,7 +290,7 @@ function modules_change_disabled($id_agent_module, $new_value = 1) {
|
||||||
return ERR_GENERIC;
|
return ERR_GENERIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a module from an agent.
|
* Deletes a module from an agent.
|
||||||
*
|
*
|
||||||
|
@ -299,20 +299,20 @@ function modules_change_disabled($id_agent_module, $new_value = 1) {
|
||||||
* @return True if the module was deleted. False if not.
|
* @return True if the module was deleted. False if not.
|
||||||
*/
|
*/
|
||||||
function modules_delete_agent_module ($id_agent_module) {
|
function modules_delete_agent_module ($id_agent_module) {
|
||||||
if (empty($id_agent_module))
|
if (empty($id_agent_module))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (is_array($id_agent_module)) {
|
if (is_array($id_agent_module)) {
|
||||||
$id_agents = db_get_all_rows_sql(
|
$id_agents = db_get_all_rows_sql(
|
||||||
sprintf('SELECT id_agente
|
sprintf('SELECT id_agente
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE id_agente_modulo IN (%s)
|
WHERE id_agente_modulo IN (%s)
|
||||||
GROUP BY id_agente', implode(',', $id_agent_module)));
|
GROUP BY id_agente', implode(',', $id_agent_module)));
|
||||||
|
|
||||||
foreach($id_agents as $k => $v) {
|
foreach($id_agents as $k => $v) {
|
||||||
$id_agents[$k] = $v['id_agente'];
|
$id_agents[$k] = $v['id_agente'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update update flags to server side
|
// Update update flags to server side
|
||||||
db_process_sql (sprintf('UPDATE tagente
|
db_process_sql (sprintf('UPDATE tagente
|
||||||
SET update_module_count=1, update_alert_count=1
|
SET update_module_count=1, update_alert_count=1
|
||||||
|
@ -321,18 +321,18 @@ function modules_delete_agent_module ($id_agent_module) {
|
||||||
else {
|
else {
|
||||||
// Read module data
|
// Read module data
|
||||||
$id_agent = modules_get_agentmodule_agent($id_agent_module);
|
$id_agent = modules_get_agentmodule_agent($id_agent_module);
|
||||||
|
|
||||||
// Update update flags to server side
|
// Update update flags to server side
|
||||||
db_process_sql (sprintf('UPDATE tagente
|
db_process_sql (sprintf('UPDATE tagente
|
||||||
SET update_module_count=1, update_alert_count=1
|
SET update_module_count=1, update_alert_count=1
|
||||||
WHERE id_agente = %s', $id_agent));
|
WHERE id_agente = %s', $id_agent));
|
||||||
}
|
}
|
||||||
|
|
||||||
$where = array ('id_agent_module' => $id_agent_module);
|
$where = array ('id_agent_module' => $id_agent_module);
|
||||||
|
|
||||||
$enterprise_include = enterprise_include_once(
|
enterprise_include_once("include/functions_agents.php");
|
||||||
'include/functions_config_agents.php');
|
$enterprise_include = enterprise_include_once('include/functions_config_agents.php');
|
||||||
|
|
||||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||||
if (is_array($id_agent_module)) {
|
if (is_array($id_agent_module)) {
|
||||||
foreach ($id_agent_module as $id_agent_module_item) {
|
foreach ($id_agent_module as $id_agent_module_item) {
|
||||||
|
@ -347,9 +347,9 @@ function modules_delete_agent_module ($id_agent_module) {
|
||||||
modules_get_agentmodule_name($id_agent_module));
|
modules_get_agentmodule_name($id_agent_module));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
alerts_delete_alert_agent_module (0, $where);
|
alerts_delete_alert_agent_module (0, $where);
|
||||||
|
|
||||||
db_process_sql_delete ('tgraph_source', $where);
|
db_process_sql_delete ('tgraph_source', $where);
|
||||||
db_process_sql_delete ('treport_content', $where);
|
db_process_sql_delete ('treport_content', $where);
|
||||||
db_process_sql_delete ('tevento',
|
db_process_sql_delete ('tevento',
|
||||||
|
@ -361,7 +361,7 @@ function modules_delete_agent_module ($id_agent_module) {
|
||||||
array ('nombre' => 'delete_pending', 'delete_pending' => 1, 'disabled' => 1),
|
array ('nombre' => 'delete_pending', 'delete_pending' => 1, 'disabled' => 1),
|
||||||
$where);
|
$where);
|
||||||
db_process_sql_delete('ttag_module', $where);
|
db_process_sql_delete('ttag_module', $where);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue