Merge branch 'ent-12994-mensaje-feo-de-error-cuando-no-puede-conectar-a-la-bbdd-de-historico' into 'develop'
Ent 12994 Mensaje feo de error cuando no puede conectar a la BBDD de histórico See merge request artica/pandorafms!6996
This commit is contained in:
commit
5ba4cb850a
|
@ -2,7 +2,7 @@
|
|||
echo '<script src="'.ui_get_full_url('include/javascript/jquery.current.js', false, false, false).'" type="text/javascript"></script>';
|
||||
|
||||
$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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -110,7 +117,10 @@ function mysql_connect_db(
|
|||
}
|
||||
|
||||
if (mysqli_connect_errno() > 0) {
|
||||
include 'general/mysqlerr.php';
|
||||
if ($history === false) {
|
||||
include 'general/mysqlerr.php';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +166,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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -143,9 +147,11 @@ function db_connect(
|
|||
// Display the error once even if multiple
|
||||
// connection attempts are made.
|
||||
$error = 1;
|
||||
ui_print_error_message(
|
||||
__('Error connecting to database %s at %s.', $db, $host)
|
||||
);
|
||||
if ($history === false) {
|
||||
ui_print_error_message(
|
||||
__('Error connecting to database %s at %s.', $db, $host)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue