mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
#10127 added param 'id_node' in set_validate_events for update from metaconsole
This commit is contained in:
parent
2c047cb401
commit
d49f1320f5
@ -11061,20 +11061,55 @@ function api_set_event_validate_filter($trash1, $trash2, $other, $trash3)
|
|||||||
|
|
||||||
function api_set_validate_events($id_event, $trash1, $other, $return_type, $user_in_db)
|
function api_set_validate_events($id_event, $trash1, $other, $return_type, $user_in_db)
|
||||||
{
|
{
|
||||||
$text = $other['data'];
|
$node_int = 0;
|
||||||
|
if ($other['type'] == 'string') {
|
||||||
|
returnError('Parameter error.');
|
||||||
|
return;
|
||||||
|
} else if ($other['type'] == 'array') {
|
||||||
|
$text = $other['data'][0];
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
if (isset($other['data'][1]) === true
|
||||||
|
&& empty($other['data'][1]) === false
|
||||||
|
) {
|
||||||
|
$node_int = $other['data'][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set off the standby mode when close an event
|
try {
|
||||||
$event = events_get_event($id_event);
|
if (is_metaconsole() === true
|
||||||
alerts_agent_module_standby($event['id_alert_am'], 0);
|
&& (int) $node_int > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($node_int);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
$result = events_change_status($id_event, EVENT_VALIDATE);
|
// Set off the standby mode when close an event
|
||||||
|
$event = events_get_event($id_event);
|
||||||
|
alerts_agent_module_standby($event['id_alert_am'], 0);
|
||||||
|
$result = events_change_status($id_event, EVENT_VALIDATE);
|
||||||
|
|
||||||
if ($result) {
|
|
||||||
if (!empty($text)) {
|
if (!empty($text)) {
|
||||||
// Set the comment for the validation
|
// Set the comment for the validation
|
||||||
events_comment($id_event, $text);
|
events_comment($id_event, $text);
|
||||||
}
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $node_int > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $node_int > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
returnData(
|
returnData(
|
||||||
'string',
|
'string',
|
||||||
[
|
[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user