From 5cc181a90f7d27f4ec578a8a892b4dd0ca44adf4 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Fri, 18 Sep 2015 03:09:10 -0400
Subject: [PATCH] Merge branch 'master' into 'master'
---
install/lib/mysql.lib.php | 20 +++++---------------
1 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/install/lib/mysql.lib.php b/install/lib/mysql.lib.php
index 8e40862..11fd2ec 100644
--- a/install/lib/mysql.lib.php
+++ b/install/lib/mysql.lib.php
@@ -104,6 +104,7 @@
public function setDBName($name) {
$this->dbName = $name;
+ $this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass);
if(!((bool)mysqli_query( $this->_iConnId, 'USE `' . $this->dbName . '`'))) {
$this->close();
$this->_sqlerror('Datenbank nicht gefunden / Database not found');
@@ -188,8 +189,6 @@
}
private function _query($sQuery = '') {
- global $app;
-
$this->do_connect();
if ($sQuery == '') {
@@ -206,10 +205,8 @@
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
+ $this->_sqlerror('DB::query -> error connecting');
+ exit;
}
sleep(30); // additional seconds, please!
}
@@ -441,18 +438,13 @@
* @return string escaped string
*/
public function escape($sString) {
- global $app;
if(!is_string($sString) && !is_numeric($sString)) {
- $app->log('NON-String given in escape function! (' . gettype($sString) . ')', LOGLEVEL_INFO);
- //$sAddMsg = getDebugBacktrace();
- $app->log($sAddMsg, LOGLEVEL_DEBUG);
$sString = '';
}
$cur_encoding = mb_detect_encoding($sString);
if($cur_encoding != "UTF-8") {
if($cur_encoding != 'ASCII') {
- $app->log('String ' . substr($sString, 0, 25) . '... is ' . $cur_encoding . '.', LOGLEVEL_INFO);
if($cur_encoding) $sString = mb_convert_encoding($sString, 'UTF-8', $cur_encoding);
else $sString = mb_convert_encoding($sString, 'UTF-8');
}
@@ -470,7 +462,7 @@
* @access private
*/
private function _sqlerror($sErrormsg = 'Unbekannter Fehler', $sAddMsg = '') {
- global $app, $conf;
+ global $conf;
$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());
@@ -479,9 +471,7 @@
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 . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN);
- }
+ }
}
public function affectedRows() {
--
Gitblit v1.9.1