diff --git a/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php b/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php index de4e001b1c..945695163a 100644 --- a/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php +++ b/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php @@ -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, diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index ea1adb40bf..3fff1519ed 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -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; } /**