mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:42 +01:00
do NOT used persistent connections, if they are disabled in php.ini
This commit is contained in:
parent
75403eea94
commit
4b5890a501
@ -523,7 +523,11 @@ class Db
|
||||
// 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);
|
||||
}
|
||||
$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)))
|
||||
{
|
||||
$this->ServerInfo = $this->Link_ID->ServerInfo();
|
||||
@ -1571,6 +1575,11 @@ class Db
|
||||
{
|
||||
$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))
|
||||
{
|
||||
$or_null = '';
|
||||
|
@ -159,12 +159,8 @@ class setup_header
|
||||
{
|
||||
foreach($egw_domains as $data)
|
||||
{
|
||||
error_clear_last();
|
||||
// check for persistent connection
|
||||
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()))
|
||||
// check if persistent connections are allowed
|
||||
if (substr($data['db_type'], 0, 5) === 'mysql' && !ini_get('mysqli.allow_persistent'))
|
||||
{
|
||||
$persistent = false;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user