From 40c6e8fd1822039f57b775488aaf7de58e490adb Mon Sep 17 00:00:00 2001 From: Marius Cramer Date: Thu, 16 Apr 2015 08:32:31 +0200 Subject: [PATCH] - fix for installer mysql lib --- install/lib/mysql.lib.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/install/lib/mysql.lib.php b/install/lib/mysql.lib.php index 1825eb3e3..f4f6734e6 100644 --- a/install/lib/mysql.lib.php +++ b/install/lib/mysql.lib.php @@ -71,7 +71,15 @@ class db extends mysqli $this->dbCharset = $conf["mysql"]["charset"]; $this->dbNewLink = false; $this->dbClientFlags = null; + } + public function __destruct() { + if($this->_iConnId) mysqli_close($this->_iConnId); + } + + private function connect() { + if($this->_iConnId) return true; + $this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass); $try = 0; while((!is_object($this->_iConnId) || mysqli_connect_error()) && $try < 5) { @@ -94,11 +102,7 @@ class db extends mysqli $this->_setCharset(); } - - public function __destruct() { - if($this->_iConnId) mysqli_close($this->_iConnId); - } - + public function close() { if($this->_iConnId) mysqli_close($this->_iConnId); $this->_iConnId = null; @@ -176,6 +180,8 @@ class db extends mysqli private function _query($sQuery = '') { global $app; + $this->connect(); + //if($this->isConnected == false) return false; if ($sQuery == '') { $this->_sqlerror('Keine Anfrage angegeben / No query given'); -- GitLab