mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
refactor events meta pandora_enterprise#9086
This commit is contained in:
parent
5680b82563
commit
90013603a7
@ -2054,6 +2054,10 @@ function config_process_config()
|
|||||||
config_update_value('max_execution_event_response', 10);
|
config_update_value('max_execution_event_response', 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($config['max_number_of_events_per_node'])) {
|
||||||
|
config_update_value('max_number_of_events_per_node', 100000);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($config['max_macro_fields'])) {
|
if (!isset($config['max_macro_fields'])) {
|
||||||
config_update_value('max_macro_fields', 10);
|
config_update_value('max_macro_fields', 10);
|
||||||
}
|
}
|
||||||
|
@ -1338,13 +1338,18 @@ function events_get_all(
|
|||||||
$id_server = 0;
|
$id_server = 0;
|
||||||
if (empty($filter['id_server']) === false) {
|
if (empty($filter['id_server']) === false) {
|
||||||
$id_server = $filter['id_server'];
|
$id_server = $filter['id_server'];
|
||||||
|
} else if (empty($filter['server_id']) === false) {
|
||||||
|
$id_server = $filter['server_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pagination.
|
// Pagination.
|
||||||
$pagination = '';
|
$pagination = '';
|
||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true && empty($id_server) === true) {
|
||||||
// TODO: XXX TOTAL 10000 - 10000000. settins meta 300000; TIP. capturra el error.
|
// TODO: XXX TIP. capturra el error.
|
||||||
$pagination = ' LIMIT 100000 ';
|
$pagination = sprintf(
|
||||||
|
' LIMIT %d',
|
||||||
|
$config['max_number_of_events_per_node']
|
||||||
|
);
|
||||||
} else if (isset($limit, $offset) === true && $limit > 0) {
|
} else if (isset($limit, $offset) === true && $limit > 0) {
|
||||||
$pagination = sprintf(' LIMIT %d OFFSET %d', $limit, $offset);
|
$pagination = sprintf(' LIMIT %d OFFSET %d', $limit, $offset);
|
||||||
}
|
}
|
||||||
@ -1512,7 +1517,13 @@ function events_get_all(
|
|||||||
('.$sql.') tbase';
|
('.$sql.') tbase';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($count !== true) {
|
if ($count === true
|
||||||
|
&& (is_metaconsole() !== false
|
||||||
|
|| (is_metaconsole() === true && empty($filter['server_id']) === false))
|
||||||
|
) {
|
||||||
|
$sql = 'SELECT count(*) as nitems FROM ('.$sql.') tt';
|
||||||
|
}
|
||||||
|
|
||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
$result_meta = [];
|
$result_meta = [];
|
||||||
$metaconsole_connections = metaconsole_get_names();
|
$metaconsole_connections = metaconsole_get_names();
|
||||||
@ -1569,6 +1580,7 @@ function events_get_all(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($filter['server_id']) === true) {
|
||||||
// TODO: XXX;
|
// TODO: XXX;
|
||||||
hd($sort_field, true);
|
hd($sort_field, true);
|
||||||
hd($order, true);
|
hd($order, true);
|
||||||
@ -1620,20 +1632,23 @@ function events_get_all(
|
|||||||
$count = count($data);
|
$count = count($data);
|
||||||
$end = ((int) $offset !== 0) ? ($offset + $limit) : $limit;
|
$end = ((int) $offset !== 0) ? ($offset + $limit) : $limit;
|
||||||
$finally = array_slice($data, $offset, $end, true);
|
$finally = array_slice($data, $offset, $end, true);
|
||||||
|
|
||||||
$return = [
|
$return = [
|
||||||
'data' => $finally,
|
'data' => $finally,
|
||||||
'total' => $count,
|
'total' => $count,
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
// TODO: XXX limit * nodes.
|
$return = array_slice(
|
||||||
$return = array_slice($data, 0, 1000000, true);
|
$data,
|
||||||
|
0,
|
||||||
|
($config['max_number_of_events_per_node'] * count($metaconsole_connections)),
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$sql = 'SELECT count(*) as nitems FROM ('.$sql.') tt';
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($return_sql) {
|
if ($return_sql) {
|
||||||
|
@ -352,7 +352,10 @@ if (is_ajax() === true) {
|
|||||||
$history
|
$history
|
||||||
);
|
);
|
||||||
|
|
||||||
if (is_metaconsole() === false) {
|
if (is_metaconsole() === false
|
||||||
|
|| (is_metaconsole() === true
|
||||||
|
&& empty($filter['server_id']) === false)
|
||||||
|
) {
|
||||||
$count = events_get_all(
|
$count = events_get_all(
|
||||||
'count',
|
'count',
|
||||||
$filter,
|
$filter,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user