Merge branch 'ent-8791-base-de-datos-historica-para-metaconsola' into 'develop'

add historical database setup in metaconsole pandora_enterprise#8791

See merge request artica/pandorafms!5047
This commit is contained in:
Diego Muñoz-Reja 2022-09-21 15:23:38 +00:00
commit fd04dda6d8
3 changed files with 19 additions and 13 deletions

View File

@ -4101,17 +4101,20 @@ function ui_toggle(
// JQuery Toggle. // JQuery Toggle.
$output .= '<script type="text/javascript">'."\n"; $output .= '<script type="text/javascript">'."\n";
$output .= ' var hide_tgl_ctrl_'.$uniqid.' = '.(int) $hidden_default.";\n"; $output .= ' var hide_tgl_ctrl_'.$uniqid.' = '.(int) $hidden_default.";\n";
$output .= ' var is_metaconsole = '.(int) is_metaconsole().";\n";
$output .= ' /* <![CDATA[ */'."\n"; $output .= ' /* <![CDATA[ */'."\n";
$output .= " $(document).ready (function () {\n"; $output .= " $(document).ready (function () {\n";
$output .= " $('#checkbox-".$switch_name."').click(function() {\n"; $output .= " $('#checkbox-".$switch_name."').click(function() {\n";
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n"; $output .= ' if (is_metaconsole == 0) {';
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n"; $output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n"; $output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " }\n"; $output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " else {\n"; $output .= " }\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n"; $output .= " else {\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n"; $output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
$output .= " }\n"; $output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " }\n";
$output .= " }\n";
$output .= " });\n"; $output .= " });\n";
$output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n"; $output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n";
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n"; $output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";

View File

@ -73,7 +73,7 @@ final class Config
$config['history_db_user'], $config['history_db_user'],
io_output_password($config['history_db_pass']), io_output_password($config['history_db_pass']),
$config['history_db_name'], $config['history_db_name'],
$config['history_db_port'] (int) $config['history_db_port']
); );
if ($rc === false) { if ($rc === false) {
@ -84,7 +84,7 @@ final class Config
$config['history_db_name'], $config['history_db_name'],
$config['history_db_user'], $config['history_db_user'],
io_output_password($config['history_db_pass']), io_output_password($config['history_db_pass']),
$config['history_db_port'], (int) $config['history_db_port'],
false false
); );
} }

View File

@ -135,9 +135,9 @@ final class DBMaintainer
$this->user = $params['user']; $this->user = $params['user'];
$this->pass = io_output_password($params['pass']); $this->pass = io_output_password($params['pass']);
$this->host = $params['host']; $this->host = $params['host'];
$this->port = $params['port']; $this->port = (int) $params['port'];
$this->name = $params['name']; $this->name = $params['name'];
$this->charset = $params['charset']; $this->charset = (isset($params['charset']) === true) ? $params['charset'] : '';
// Try to connect. // Try to connect.
$this->connect(); $this->connect();
@ -170,7 +170,10 @@ final class DBMaintainer
if ($rc === false) { if ($rc === false) {
$this->dbh = null; $this->dbh = null;
$this->connected = false; $this->connected = false;
$this->lastError = __('Connection problems'); $this->lastError = __(
'Connection problems: %s',
mysqli_connect_error()
);
} else { } else {
$dbc = new \mysqli( $dbc = new \mysqli(
$this->host, $this->host,