From f7ec00b2f8ba3efc5bdeacef9c813f8a826ae3be Mon Sep 17 00:00:00 2001
From: Patrick Anders <p.anders@timmehosting.de>
Date: Wed, 10 Dec 2014 08:44:26 -0500
Subject: [PATCH] add Spdy option - http://en.wikipedia.org/wiki/SPDY
---
server/lib/classes/db_mysql.inc.php | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index 488a381..c0eed64 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -176,6 +176,7 @@
private function _query($sQuery = '') {
global $app;
+ //if($this->isConnected == false) return false;
if ($sQuery == '') {
$this->_sqlerror('Keine Anfrage angegeben / No query given');
return false;
@@ -187,6 +188,17 @@
$ok = mysqli_ping($this->_iConnId);
if(!$ok) {
if(!mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
+ if($this->errorNumber == '111') {
+ // server is not available
+ if($try > 9) {
+ if(isset($app) && isset($app->forceErrorExit)) {
+ $app->forceErrorExit('Database connection failure!');
+ }
+ // if we reach this, the app object is missing or has no exit method, so we continue as normal
+ }
+ sleep(30); // additional seconds, please!
+ }
+
if($try > 9) {
$this->_sqlerror('DB::query -> reconnect');
return false;
@@ -269,11 +281,11 @@
}
public function queryOne($sQuery = '') {
- return $this->query_one($sQuery);
+ return call_user_func_array(array(&$this, 'queryOneRecord'), func_get_args());
}
public function query_one($sQuery = '') {
- return $this->queryOneRecord($sQuery);
+ return call_user_func_array(array(&$this, 'queryOneRecord'), func_get_args());
}
/**
@@ -302,11 +314,11 @@
}
public function queryAll($sQuery = '') {
- return $this->queryAllRecords($sQuery);
+ return call_user_func_array(array(&$this, 'queryAllRecords'), func_get_args());
}
public function query_all($sQuery = '') {
- return $this->queryAllRecords($sQuery);
+ return call_user_func_array(array(&$this, 'queryAllRecords'), func_get_args());
}
/**
@@ -335,7 +347,7 @@
}
public function query_all_array($sQuery = '') {
- return $this->queryAllArray($sQuery);
+ return call_user_func_array(array(&$this, 'queryAllArray'), func_get_args());
}
@@ -388,7 +400,7 @@
global $app;
if(!is_string($sString) && !is_numeric($sString)) {
$app->log('NON-String given in escape function! (' . gettype($sString) . ')', LOGLEVEL_INFO);
- $sAddMsg = getDebugBacktrace();
+ //$sAddMsg = getDebugBacktrace();
$app->log($sAddMsg, LOGLEVEL_DEBUG);
$sString = '';
}
@@ -419,12 +431,12 @@
$mysql_error = (is_object($this->_iConnId) ? mysqli_error($this->_iConnId) : mysqli_connect_error());
$mysql_errno = (is_object($this->_iConnId) ? mysqli_errno($this->_iConnId) : mysqli_connect_errno());
- $sAddMsg .= getDebugBacktrace();
+ //$sAddMsg .= getDebugBacktrace();
if($this->show_error_messages && $conf['demo_mode'] === false) {
echo $sErrormsg . $sAddMsg;
} else if(is_object($app) && method_exists($app, 'log')) {
- $app->log($sErrormsg . $sAddMsg, LOGLEVEL_WARN);
+ $app->log($sErrormsg . $sAddMsg . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN);
}
}
--
Gitblit v1.9.1