mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
do NOT used persistent connections, if they are disabled in php.ini
This commit is contained in:
parent
a3a9761372
commit
023e99673c
@ -523,7 +523,11 @@ class Db
|
|||||||
// set a connection timeout of 1 second, to allow quicker failover to other db-nodes (default is 20s)
|
// set a connection timeout of 1 second, to allow quicker failover to other db-nodes (default is 20s)
|
||||||
$this->Link_ID->setConnectionParameter(MYSQLI_OPT_CONNECT_TIMEOUT, 1);
|
$this->Link_ID->setConnectionParameter(MYSQLI_OPT_CONNECT_TIMEOUT, 1);
|
||||||
}
|
}
|
||||||
$connect = $GLOBALS['egw_info']['server']['db_persistent'] ? 'PConnect' : 'Connect';
|
$connect = $GLOBALS['egw_info']['server']['db_persistent'] &&
|
||||||
|
// do NOT attempt persistent connection, if it is switched off in php.ini (it will only cause a warning)
|
||||||
|
($Type !== 'mysqli' || ini_get('mysqli.allow_persistent')) ?
|
||||||
|
'PConnect' : 'Connect';
|
||||||
|
|
||||||
if (($Ok = $this->Link_ID->$connect($Host, $User, $Password, $Database)))
|
if (($Ok = $this->Link_ID->$connect($Host, $User, $Password, $Database)))
|
||||||
{
|
{
|
||||||
$this->ServerInfo = $this->Link_ID->ServerInfo();
|
$this->ServerInfo = $this->Link_ID->ServerInfo();
|
||||||
@ -1571,6 +1575,11 @@ class Db
|
|||||||
{
|
{
|
||||||
$data = array_shift($data);
|
$data = array_shift($data);
|
||||||
}
|
}
|
||||||
|
// array for SET or VALUES, not WHERE --> automatic store comma-separated
|
||||||
|
if (is_array($data) && $glue === ',' && in_array($column_type, ['varchar','ascii']))
|
||||||
|
{
|
||||||
|
$data = implode(',', $data);
|
||||||
|
}
|
||||||
if (is_array($data))
|
if (is_array($data))
|
||||||
{
|
{
|
||||||
$or_null = '';
|
$or_null = '';
|
||||||
|
@ -159,12 +159,8 @@ class setup_header
|
|||||||
{
|
{
|
||||||
foreach($egw_domains as $data)
|
foreach($egw_domains as $data)
|
||||||
{
|
{
|
||||||
error_clear_last();
|
// check if persistent connections are allowed
|
||||||
// check for persistent connection
|
if (substr($data['db_type'], 0, 5) === 'mysql' && !ini_get('mysqli.allow_persistent'))
|
||||||
if (substr($data['db_type'], 0, 5) === 'mysql' &&
|
|
||||||
function_exists('mysqli_connect') &&
|
|
||||||
@mysqli_connect('p:'.$data['db_host']) &&
|
|
||||||
preg_match('/Persistent connections are disabled/i', error_get_last()))
|
|
||||||
{
|
{
|
||||||
$persistent = false;
|
$persistent = false;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user