Merge remote-tracking branch 'origin/develop' into ent-9229-revisar-comportamiento-de-widgets-con-elementos-eliminados

This commit is contained in:
Daniel Barbero 2022-08-01 13:00:49 +02:00
commit 13c1f78463
30 changed files with 153 additions and 97 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.763-220728
Version: 7.0NG.763-220801
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.763-220728"
pandora_version="7.0NG.763-220801"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.763';
use constant AGENT_BUILD => '220728';
use constant AGENT_BUILD => '220801';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.763
%define release 220728
%define release 220801
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.763
%define release 220728
%define release 220801
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.763"
PI_BUILD="220728"
PI_BUILD="220801"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{220728}
{220801}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.763 Build 220728")
#define PANDORA_VERSION ("7.0NG.763 Build 220801")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.763(Build 220728))"
VALUE "ProductVersion", "(7.0NG.763(Build 220801))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.763-220728
Version: 7.0NG.763-220801
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.763-220728"
pandora_version="7.0NG.763-220801"
package_pear=0
package_pandora=1

View File

@ -90,6 +90,7 @@ $node_id = (int) get_parameter('node_id', 0);
if ($get_comments === true) {
$event = get_parameter('event', false);
$event_rep = get_parameter('event_rep', false);
if ($event === false) {
return __('Failed to retrieve comments');
}
@ -97,27 +98,30 @@ if ($get_comments === true) {
$eventsGrouped = [];
// Consider if the event is grouped.
$whereGrouped = '1=1';
// Default grouped message filtering (evento and estado).
$whereGrouped = sprintf(
'`evento` = "%s" AND `estado` = "%s" AND `event_type` = "%s" ',
$event['evento'],
$event['estado'],
$event['event_type']
);
// If id_agente is reported, filter the messages by them as well.
if ((int) $event['id_agente'] > 0) {
$whereGrouped .= sprintf(
' AND `id_agente` = %d',
(int) $event['id_agente']
if (isset($event_rep) === true && $event_rep > 0) {
// Default grouped message filtering (evento and estado).
$whereGrouped = sprintf(
'`evento` = "%s" AND `estado` = "%s"',
$event['evento'],
$event['estado']
);
}
if ((int) $event['id_agentmodule'] > 0) {
$whereGrouped .= sprintf(
' AND `id_agentmodule` = %d',
(int) $event['id_agentmodule']
);
// If id_agente is reported, filter the messages by them as well.
if ((int) $event['id_agente'] > 0) {
$whereGrouped .= sprintf(
' AND `id_agente` = %d',
(int) $event['id_agente']
);
}
if ((int) $event['id_agentmodule'] > 0) {
$whereGrouped .= sprintf(
' AND `id_agentmodule` = %d',
(int) $event['id_agentmodule']
);
}
} else {
$whereGrouped = sprintf('`id_evento` = %d', $event['id_evento']);
}
try {
@ -1629,7 +1633,7 @@ if ($get_extended_event) {
$filter = get_parameter('filter', []);
$similar_ids = get_parameter('similar_ids', $event_id);
$group_rep = $filter['group_rep'];
$event_rep = $event['event_rep'];
$event_rep = $group_rep;
$timestamp_first = $event['timestamp_first'];
$timestamp_last = $event['timestamp_last'];
$server_id = $event['server_id'];
@ -1964,7 +1968,8 @@ if ($get_extended_event) {
data : {
page: "include/ajax/events",
get_comments: 1,
event: '.json_encode($event).'
event: '.json_encode($event).',
event_rep: '.$event_rep.'
},
dataType : "html",
success: function (data) {

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC220728';
$build_version = 'PC220801';
$pandora_version = 'v7.0NG.763';
// Do not overwrite default timezone set if defined.

View File

@ -1091,18 +1091,36 @@ function events_get_all(
// Custom data.
if (empty($filter['custom_data']) === false) {
if ($filter['custom_data_filter_type'] === '1') {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1
AND (JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) ',
io_safe_output($filter['custom_data'])
);
if (isset($config['dbconnection']->server_version) === true
&& $config['dbconnection']->server_version > 80000
) {
if ($filter['custom_data_filter_type'] === '1') {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1
AND (JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) ',
io_safe_output($filter['custom_data'])
);
} else {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1
AND (JSON_SEARCH(JSON_KEYS(custom_data), "all", lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) IS NOT NULL) ',
io_safe_output($filter['custom_data'])
);
}
} else {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1
AND (JSON_SEARCH(JSON_KEYS(custom_data), "all", lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) IS NOT NULL) ',
io_safe_output($filter['custom_data'])
);
if ($filter['custom_data_filter_type'] === '1') {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1 AND JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") ',
$filter['custom_data'],
$filter['custom_data']
);
} else {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1 AND JSON_KEYS(custom_data) REGEXP "%s" ',
$filter['custom_data'],
$filter['custom_data']
);
}
}
}

View File

@ -64,39 +64,55 @@ final class Config
|| $config['history_db_connection'] === false
) {
ob_start();
$config['history_db_connection'] = db_connect(
$config['history_db_host'],
$config['history_db_name'],
$link = mysqli_init();
$link->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2);
$rc = mysqli_real_connect(
$link,
$$config['history_db_host'],
$config['history_db_user'],
io_output_password($config['history_db_pass']),
$config['history_db_port'],
false
$config['history_db_name'],
$config['history_db_port']
);
if ($rc === false) {
$config['history_db_connection'] = false;
} else {
$config['history_db_connection'] = db_connect(
$config['history_db_host'],
$config['history_db_name'],
$config['history_db_user'],
io_output_password($config['history_db_pass']),
$config['history_db_port'],
false
);
}
ob_get_clean();
}
if ($config['history_db_connection'] !== false) {
$data = \db_get_all_rows_sql(
'SELECT * FROM `tconfig`',
false,
false,
$config['history_db_connection']
if ($config['history_db_connection'] !== false) {
$data = \db_get_all_rows_sql(
'SELECT * FROM `tconfig`',
false,
false,
$config['history_db_connection']
);
}
if (is_array($data) !== true) {
return [];
}
self::$settings = array_reduce(
$data,
function ($carry, $item) {
$carry[$item['token']] = $item['value'];
return $carry;
},
[]
);
}
if (is_array($data) !== true) {
return [];
}
self::$settings = array_reduce(
$data,
function ($carry, $item) {
$carry[$item['token']] = $item['value'];
return $carry;
},
[]
);
}

View File

@ -156,7 +156,10 @@ final class DBMaintainer
return true;
}
$dbc = new \mysqli(
$link = mysqli_init();
$link->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2);
$rc = mysqli_real_connect(
$link,
$this->host,
$this->user,
$this->pass,
@ -164,25 +167,39 @@ final class DBMaintainer
$this->port
);
if ((bool) $dbc->connect_error === true) {
if ($rc === false) {
$this->dbh = null;
$this->connected = false;
$this->lastError = $dbc->connect_errno.': '.$dbc->connect_error;
$this->lastError = __('Connection problems');
} else {
$this->dbh = $dbc;
if (empty($this->charset) === false) {
$dbc->set_charset($this->charset);
}
$dbc = new \mysqli(
$this->host,
$this->user,
$this->pass,
null,
$this->port
);
if ($this->dbh->select_db($this->name) === false) {
$this->lastError = $this->dbh->errno.': '.$this->dbh->error;
$this->ready = false;
if ((bool) $dbc->connect_error === true) {
$this->dbh = null;
$this->connected = false;
$this->lastError = $dbc->connect_errno.': '.$dbc->connect_error;
} else {
$this->lastError = null;
$this->ready = true;
}
$this->dbh = $dbc;
if (empty($this->charset) === false) {
$dbc->set_charset($this->charset);
}
$this->connected = true;
if ($this->dbh->select_db($this->name) === false) {
$this->lastError = $this->dbh->errno.': '.$this->dbh->error;
$this->ready = false;
} else {
$this->lastError = null;
$this->ready = true;
}
$this->connected = true;
}
}
}

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.763';
$build = '220728';
$build = '220801';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -945,7 +945,7 @@ if (is_ajax() === true) {
$custom_data_str = '';
if (isset($custom_data) === true && empty($custom_data) === false) {
foreach ($custom_data as $key => $value) {
$custom_data_str .= $value['attr_name'].' = '.$value['val'].'<br>';
$custom_data_str .= $key.' = '.$value.'<br>';
}
}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.763
%define release 220728
%define release 220801
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.763
%define release 220728
%define release 220801
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.763
%define release 220728
%define release 220801
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.763-220728
Version: 7.0NG.763-220801
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.763-220728"
pandora_version="7.0NG.763-220801"
package_cpan=0
package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.763";
my $pandora_build = "220728";
my $pandora_build = "220801";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.763";
my $pandora_build = "220728";
my $pandora_build = "220801";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.763
%define release 220728
%define release 220801
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.763
%define release 220728
%define release 220801
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.763"
PI_BUILD="220728"
PI_BUILD="220801"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.763 Build 220728";
my $version = "7.0NG.763 Build 220801";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.763 Build 220728";
my $version = "7.0NG.763 Build 220801";
# save program name for logging
my $progname = basename($0);