Merge branch 'ent-9273-comprobacion-base-de-datos-de-historico-del-setup-provoca-error-504' into 'develop'
fixed history timeout pandora_enterprise#9273 See merge request artica/pandorafms!5034
This commit is contained in:
commit
9751167f56
|
@ -64,39 +64,55 @@ final class Config
|
||||||
|| $config['history_db_connection'] === false
|
|| $config['history_db_connection'] === false
|
||||||
) {
|
) {
|
||||||
ob_start();
|
ob_start();
|
||||||
$config['history_db_connection'] = db_connect(
|
|
||||||
$config['history_db_host'],
|
$link = mysqli_init();
|
||||||
$config['history_db_name'],
|
$link->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2);
|
||||||
|
$rc = mysqli_real_connect(
|
||||||
|
$link,
|
||||||
|
$$config['history_db_host'],
|
||||||
$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'],
|
$config['history_db_name'],
|
||||||
false
|
$config['history_db_port']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($rc === false) {
|
||||||
|
$config['history_db_connection'] = false;
|
||||||
|
} else {
|
||||||
|
$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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
ob_get_clean();
|
ob_get_clean();
|
||||||
}
|
|
||||||
|
|
||||||
if ($config['history_db_connection'] !== false) {
|
if ($config['history_db_connection'] !== false) {
|
||||||
$data = \db_get_all_rows_sql(
|
$data = \db_get_all_rows_sql(
|
||||||
'SELECT * FROM `tconfig`',
|
'SELECT * FROM `tconfig`',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
$config['history_db_connection']
|
$config['history_db_connection']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($data) !== true) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$settings = array_reduce(
|
||||||
|
$data,
|
||||||
|
function ($carry, $item) {
|
||||||
|
$carry[$item['token']] = $item['value'];
|
||||||
|
return $carry;
|
||||||
|
},
|
||||||
|
[]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($data) !== true) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
self::$settings = array_reduce(
|
|
||||||
$data,
|
|
||||||
function ($carry, $item) {
|
|
||||||
$carry[$item['token']] = $item['value'];
|
|
||||||
return $carry;
|
|
||||||
},
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,10 @@ final class DBMaintainer
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbc = new \mysqli(
|
$link = mysqli_init();
|
||||||
|
$link->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2);
|
||||||
|
$rc = mysqli_real_connect(
|
||||||
|
$link,
|
||||||
$this->host,
|
$this->host,
|
||||||
$this->user,
|
$this->user,
|
||||||
$this->pass,
|
$this->pass,
|
||||||
|
@ -164,25 +167,39 @@ final class DBMaintainer
|
||||||
$this->port
|
$this->port
|
||||||
);
|
);
|
||||||
|
|
||||||
if ((bool) $dbc->connect_error === true) {
|
if ($rc === false) {
|
||||||
$this->dbh = null;
|
$this->dbh = null;
|
||||||
$this->connected = false;
|
$this->connected = false;
|
||||||
$this->lastError = $dbc->connect_errno.': '.$dbc->connect_error;
|
$this->lastError = __('Connection problems');
|
||||||
} else {
|
} else {
|
||||||
$this->dbh = $dbc;
|
$dbc = new \mysqli(
|
||||||
if (empty($this->charset) === false) {
|
$this->host,
|
||||||
$dbc->set_charset($this->charset);
|
$this->user,
|
||||||
}
|
$this->pass,
|
||||||
|
null,
|
||||||
|
$this->port
|
||||||
|
);
|
||||||
|
|
||||||
if ($this->dbh->select_db($this->name) === false) {
|
if ((bool) $dbc->connect_error === true) {
|
||||||
$this->lastError = $this->dbh->errno.': '.$this->dbh->error;
|
$this->dbh = null;
|
||||||
$this->ready = false;
|
$this->connected = false;
|
||||||
|
$this->lastError = $dbc->connect_errno.': '.$dbc->connect_error;
|
||||||
} else {
|
} else {
|
||||||
$this->lastError = null;
|
$this->dbh = $dbc;
|
||||||
$this->ready = true;
|
if (empty($this->charset) === false) {
|
||||||
}
|
$dbc->set_charset($this->charset);
|
||||||
|
}
|
||||||
|
|
||||||
$this->connected = true;
|
if ($this->dbh->select_db($this->name) === false) {
|
||||||
|
$this->lastError = $this->dbh->errno.': '.$this->dbh->error;
|
||||||
|
$this->ready = false;
|
||||||
|
} else {
|
||||||
|
$this->lastError = null;
|
||||||
|
$this->ready = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->connected = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue