mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge branch 'ent-6030-Problema-codificacion' into 'develop'
Ent 6030 problema codificacion See merge request artica/pandorafms!3329
This commit is contained in:
commit
5397586470
@ -276,6 +276,9 @@ $table->data[$i++][1] = html_print_checkbox_switch('event_storm_protection', 1,
|
|||||||
$table->data[$i][0] = __('Command Snapshot');
|
$table->data[$i][0] = __('Command Snapshot');
|
||||||
$table->data[$i++][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
|
$table->data[$i++][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
|
||||||
|
|
||||||
|
$table->data[$i][0] = __('Change remote config encoding');
|
||||||
|
$table->data[$i++][1] = html_print_checkbox_switch('use_custom_encoding', 1, $config['use_custom_encoding'], true);
|
||||||
|
|
||||||
$table->data[$i][0] = __('Server logs directory');
|
$table->data[$i][0] = __('Server logs directory');
|
||||||
$table->data[$i++][1] = html_print_input_text(
|
$table->data[$i++][1] = html_print_input_text(
|
||||||
'server_log_dir',
|
'server_log_dir',
|
||||||
|
@ -287,6 +287,10 @@ function config_update_config()
|
|||||||
$error_update[] = __('Command Snapshot');
|
$error_update[] = __('Command Snapshot');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config_update_value('use_custom_encoding', get_parameter('use_custom_encoding', 0))) {
|
||||||
|
$error_update[] = __('Use custom encoding');
|
||||||
|
}
|
||||||
|
|
||||||
if (!config_update_value('server_log_dir', io_safe_input(strip_tags(io_safe_output(get_parameter('server_log_dir')))))) {
|
if (!config_update_value('server_log_dir', io_safe_input(strip_tags(io_safe_output(get_parameter('server_log_dir')))))) {
|
||||||
$error_update[] = __('Server logs directory');
|
$error_update[] = __('Server logs directory');
|
||||||
}
|
}
|
||||||
@ -2799,6 +2803,10 @@ function config_process_config()
|
|||||||
config_update_value('event_storm_protection', 0);
|
config_update_value('event_storm_protection', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($config['use_custom_encoding'])) {
|
||||||
|
config_update_value('use_custom_encoding', 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($config['server_log_dir'])) {
|
if (!isset($config['server_log_dir'])) {
|
||||||
config_update_value('server_log_dir', '');
|
config_update_value('server_log_dir', '');
|
||||||
}
|
}
|
||||||
|
@ -177,6 +177,8 @@ sub pandora_get_sharedconfig ($$) {
|
|||||||
|
|
||||||
$pa_config->{"event_storm_protection"} = pandora_get_tconfig_token ($dbh, 'event_storm_protection', 0);
|
$pa_config->{"event_storm_protection"} = pandora_get_tconfig_token ($dbh, 'event_storm_protection', 0);
|
||||||
|
|
||||||
|
$pa_config->{"use_custom_encoding"} = pandora_get_tconfig_token ($dbh, 'use_custom_encoding', 0);
|
||||||
|
|
||||||
if ($pa_config->{'include_agents'} eq '') {
|
if ($pa_config->{'include_agents'} eq '') {
|
||||||
$pa_config->{'include_agents'} = 0;
|
$pa_config->{'include_agents'} = 0;
|
||||||
}
|
}
|
||||||
@ -472,6 +474,7 @@ sub pandora_load_config {
|
|||||||
$pa_config->{"stats_interval"} = 300;
|
$pa_config->{"stats_interval"} = 300;
|
||||||
$pa_config->{"agentaccess"} = 1;
|
$pa_config->{"agentaccess"} = 1;
|
||||||
$pa_config->{"event_storm_protection"} = 0;
|
$pa_config->{"event_storm_protection"} = 0;
|
||||||
|
$pa_config->{"use_custom_encoding"} = 0;
|
||||||
$pa_config->{"node_metaconsole"} = 0; # > 7.0NG
|
$pa_config->{"node_metaconsole"} = 0; # > 7.0NG
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -374,14 +374,26 @@ our $THRRUN :shared = 1;
|
|||||||
################################################################################
|
################################################################################
|
||||||
## Reads a file and returns entire content or undef if error.
|
## Reads a file and returns entire content or undef if error.
|
||||||
################################################################################
|
################################################################################
|
||||||
sub read_file {
|
sub read_file($;$) {
|
||||||
my $path = shift;
|
my ($path, $enc) = @_;
|
||||||
|
|
||||||
my $_FILE;
|
my $_FILE;
|
||||||
|
|
||||||
|
if (!defined($enc)) {
|
||||||
if( !open($_FILE, "<", $path) ) {
|
if( !open($_FILE, "<", $path) ) {
|
||||||
# failed to open, return undef
|
# failed to open, return undef
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if ( $enc eq '' ) {
|
||||||
|
$enc = 'utf8';
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !open($_FILE, "<:encoding($enc)", $path) ) {
|
||||||
|
# failed to open, return undef
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Slurp configuration file content.
|
# Slurp configuration file content.
|
||||||
my $content = do { local $/; <$_FILE> };
|
my $content = do { local $/; <$_FILE> };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user