diff --git a/pandora_console/general/mysqlerr.php b/pandora_console/general/mysqlerr.php index 10d385bbe4..c777da51da 100644 --- a/pandora_console/general/mysqlerr.php +++ b/pandora_console/general/mysqlerr.php @@ -2,7 +2,7 @@ echo ''; $message = ''; - +$config['ignore_cache_translate'] = true; if ($config['history_db_connection'] === false) { $message = __('Failure to connect to historical database, please check the configuration or contact system administrator if you need assistance.'); } else { diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 8f57ec9138..9e9a1246b7 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -314,6 +314,13 @@ class ConsoleSupervisor */ $this->checkTotalModulesByAgent(); + + /* + * Check connection with historical DB (if enabled). + * NOTIF.HISTORYDB + */ + + $this->checkPandoraHistoryDB(); } @@ -2041,7 +2048,7 @@ class ConsoleSupervisor 'title' => __('Historical database not available'), 'message' => __('Historical database is enabled, though not accessible with the current configuration.'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db', - 'icon_notification' => self::ICON_QUESTION, + 'icon_notification' => self::ICON_ERROR, ] ); } else { diff --git a/pandora_console/include/db/mysql.php b/pandora_console/include/db/mysql.php index 1c06b9d71c..e87042238b 100644 --- a/pandora_console/include/db/mysql.php +++ b/pandora_console/include/db/mysql.php @@ -33,7 +33,8 @@ function mysql_connect_db( $port=null, $charset=null, $ssl=null, - $verify=null + $verify=null, + $history=false ) { global $config; @@ -83,11 +84,17 @@ function mysql_connect_db( try { $connect_id = mysqli_connect($host, $user, $pass, $db, $port); if (mysqli_connect_errno() > 0) { - include 'general/mysqlerr.php'; + if ($history === false) { + include 'general/mysqlerr.php'; + } + return false; } } catch (\mysqli_sql_exception $e) { - include 'general/mysqlerr.php'; + if ($history === false) { + include 'general/mysqlerr.php'; + } + return false; } @@ -156,7 +163,7 @@ function mysql_db_get_all_rows_sql($sql, $search_history_db=false, $cache=true, // Connect to the history DB if (!isset($config['history_db_connection']) || $config['history_db_connection'] === false) { - $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); + $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, null, true); } if ($config['history_db_connection'] !== false) { diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 2e7ea13a8e..13c0028707 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6904,7 +6904,7 @@ function get_defined_translation($string) } } - if (is_array($cache_translation) === true && count($cache_translation) === 0) { + if ($config['ignore_cache_translate'] !== true && is_array($cache_translation) === true && count($cache_translation) === 0) { $cache_translation_all = db_get_all_rows_sql( sprintf( 'SELECT translation, string diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 3872b405a0..cb9c7f8033 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -87,7 +87,8 @@ function db_connect( $pass=null, $port=null, $critical=true, - $charset=null + $charset=null, + $history=false, ) { global $config; static $error = 0; @@ -100,7 +101,10 @@ function db_connect( $user, $pass, $port, - $charset + $charset, + null, + null, + $history, ); break;