#10633 added token for control check conexion interval

This commit is contained in:
Daniel Cebrian 2023-03-14 13:16:58 +01:00
parent 27beea7319
commit d315d4cda7
4 changed files with 23 additions and 5 deletions

View File

@ -595,6 +595,14 @@ $table->data[$i++][1] = html_print_checkbox_switch(
true
);
$table->data[$i][0] = __('Check conexion interval');
$table->data[$i++][1] = html_print_input_number(
[
'name' => 'check_conexion_interval',
'min' => 90,
'value' => $config['check_conexion_interval'],
]
);
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
echo '<fieldset>';

View File

@ -368,6 +368,10 @@ function config_update_config()
$error_update[] = __('Enable console report');
}
if (config_update_value('check_conexion_interval', get_parameter('check_conexion_interval'), true) === false) {
$error_update[] = __('Check conexion interval');
}
if (config_update_value('unique_ip', get_parameter('unique_ip'), true) === false) {
$error_update[] = __('Unique IP');
}
@ -2281,6 +2285,10 @@ function config_process_config()
config_update_value('reporting_console_enable', 0);
}
if (!isset($config['check_conexion_interval'])) {
config_update_value('check_conexion_interval', 180);
}
if (!isset($config['elasticsearch_ip'])) {
config_update_value('elasticsearch_ip', '');
}

View File

@ -4,16 +4,17 @@
* Connection Check
* --------------------------------------
*/
checkConnection(1);
$(document).ready(function() {
checkConnection(get_php_value("check_conexion_interval"));
});
/**
* Performs connection tests every minutes and add connection listeners
* @param {integer} time in minutes
*/
function checkConnection(minutes) {
var cicle = minutes * 60 * 1000;
function checkConnection(seconds) {
var cicle = seconds * 1000;
var checkConnection = setInterval(handleConnection, cicle);
// Connection listeters.
@ -48,7 +49,7 @@ function handleConnection() {
// If test connection file is not found, do not show message.
if (err.status != 404) {
connected = false;
msg = err;
msg = err.statusText;
} else {
connected = true;
}

View File

@ -1487,6 +1487,7 @@ echo html_print_div(
);
// Connection lost alert.
set_js_value('check_conexion_interval', $config['check_conexion_interval']);
ui_require_javascript_file('connection_check');
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
$conn_title = __('Connection with server has been lost');