mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-28 09:38:53 +01:00
some more fine-tuning of Galera checks, backported persisten connection handling from ADOdb 5.x
This commit is contained in:
parent
8596fc49bc
commit
970078e970
@ -43,11 +43,11 @@ class ADODB_mysqli extends ADOConnection {
|
||||
var $poorAffectedRows = true;
|
||||
var $clientFlags = 0;
|
||||
var $substr = "substring";
|
||||
var $port = false;
|
||||
var $socket = false;
|
||||
var $port = 3306;
|
||||
var $socket = '';
|
||||
var $_bindInputArray = false;
|
||||
var $nameQuote = '`'; /// string to use to quote identifiers and names
|
||||
var $optionFlags = array(array(MYSQLI_READ_DEFAULT_GROUP,0));
|
||||
var $optionFlags = array(array(MYSQLI_READ_DEFAULT_GROUP,0),array(MYSQLI_OPT_CONNECT_TIMEOUT,1));
|
||||
|
||||
function ADODB_mysqli()
|
||||
{
|
||||
@ -86,6 +86,10 @@ class ADODB_mysqli extends ADOConnection {
|
||||
}
|
||||
|
||||
if (strstr($argHostname,':')) list($argHostname,$this->port) = explode(':',$argHostname);
|
||||
|
||||
//http ://php.net/manual/en/mysqli.persistconns.php
|
||||
if ($persist && PHP_VERSION > 5.2 && strncmp($argHostname,'p:',2) != 0) $argHostname = 'p:'.$argHostname;
|
||||
|
||||
$ok = @mysqli_real_connect($this->_connectionID,
|
||||
$argHostname,
|
||||
$argUsername,
|
||||
|
@ -382,6 +382,7 @@ class egw_db
|
||||
*
|
||||
* To enable this check add the following to your header.inc.php:
|
||||
*
|
||||
* require_once(EGW_API_INC.'/class.egw_db.inc.php');
|
||||
* egw_db::$health_check = array('egw_db', 'galera_cluster_health');
|
||||
*
|
||||
* @param egw_db $db already connected egw_db instance to check
|
||||
@ -417,9 +418,15 @@ class egw_db
|
||||
|
||||
if ($next && ++$n >= $num_hosts+2)
|
||||
{
|
||||
return false;
|
||||
$n = 0; // start search again with default on next request
|
||||
$ret = false;
|
||||
}
|
||||
return $hosts[$n % $num_hosts];
|
||||
else
|
||||
{
|
||||
$ret = $hosts[$n % $num_hosts];
|
||||
}
|
||||
//error_log(__METHOD__."(next=".array2string($next).") n=$n returning ".array2string($ret));
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user