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>';
|
echo '<script src="'.ui_get_full_url('include/javascript/jquery.current.js', false, false, false).'" type="text/javascript"></script>';
|
||||||
|
|
||||||
$message = '';
|
$message = '';
|
||||||
|
$config['ignore_cache_translate'] = true;
|
||||||
if ($config['history_db_connection'] === false) {
|
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.');
|
$message = __('Failure to connect to historical database, please check the configuration or contact system administrator if you need assistance.');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -314,6 +314,13 @@ class ConsoleSupervisor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$this->checkTotalModulesByAgent();
|
$this->checkTotalModulesByAgent();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check connection with historical DB (if enabled).
|
||||||
|
* NOTIF.HISTORYDB
|
||||||
|
*/
|
||||||
|
|
||||||
|
$this->checkPandoraHistoryDB();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2041,7 +2048,7 @@ class ConsoleSupervisor
|
||||||
'title' => __('Historical database not available'),
|
'title' => __('Historical database not available'),
|
||||||
'message' => __('Historical database is enabled, though not accessible with the current configuration.'),
|
'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',
|
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
||||||
'icon_notification' => self::ICON_QUESTION,
|
'icon_notification' => self::ICON_ERROR,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -33,7 +33,8 @@ function mysql_connect_db(
|
||||||
$port=null,
|
$port=null,
|
||||||
$charset=null,
|
$charset=null,
|
||||||
$ssl=null,
|
$ssl=null,
|
||||||
$verify=null
|
$verify=null,
|
||||||
|
$history=false
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
@ -83,11 +84,17 @@ function mysql_connect_db(
|
||||||
try {
|
try {
|
||||||
$connect_id = mysqli_connect($host, $user, $pass, $db, $port);
|
$connect_id = mysqli_connect($host, $user, $pass, $db, $port);
|
||||||
if (mysqli_connect_errno() > 0) {
|
if (mysqli_connect_errno() > 0) {
|
||||||
|
if ($history === false) {
|
||||||
include 'general/mysqlerr.php';
|
include 'general/mysqlerr.php';
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (\mysqli_sql_exception $e) {
|
} catch (\mysqli_sql_exception $e) {
|
||||||
|
if ($history === false) {
|
||||||
include 'general/mysqlerr.php';
|
include 'general/mysqlerr.php';
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +117,10 @@ function mysql_connect_db(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mysqli_connect_errno() > 0) {
|
if (mysqli_connect_errno() > 0) {
|
||||||
|
if ($history === false) {
|
||||||
include 'general/mysqlerr.php';
|
include 'general/mysqlerr.php';
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
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
|
// Connect to the history DB
|
||||||
if (!isset($config['history_db_connection']) || $config['history_db_connection'] === false) {
|
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) {
|
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(
|
$cache_translation_all = db_get_all_rows_sql(
|
||||||
sprintf(
|
sprintf(
|
||||||
'SELECT translation, string
|
'SELECT translation, string
|
||||||
|
|
|
@ -87,7 +87,8 @@ function db_connect(
|
||||||
$pass=null,
|
$pass=null,
|
||||||
$port=null,
|
$port=null,
|
||||||
$critical=true,
|
$critical=true,
|
||||||
$charset=null
|
$charset=null,
|
||||||
|
$history=false,
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
static $error = 0;
|
static $error = 0;
|
||||||
|
@ -100,7 +101,10 @@ function db_connect(
|
||||||
$user,
|
$user,
|
||||||
$pass,
|
$pass,
|
||||||
$port,
|
$port,
|
||||||
$charset
|
$charset,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
$history,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -143,11 +147,13 @@ function db_connect(
|
||||||
// Display the error once even if multiple
|
// Display the error once even if multiple
|
||||||
// connection attempts are made.
|
// connection attempts are made.
|
||||||
$error = 1;
|
$error = 1;
|
||||||
|
if ($history === false) {
|
||||||
ui_print_error_message(
|
ui_print_error_message(
|
||||||
__('Error connecting to database %s at %s.', $db, $host)
|
__('Error connecting to database %s at %s.', $db, $host)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue