Skip to content

Commit 40c6e8f

Browse files
author
Marius Cramer
committed
- fix for installer mysql lib
1 parent ca2165e commit 40c6e8f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

install/lib/mysql.lib.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,15 @@ public function __construct($host = NULL , $user = NULL, $pass = NULL, $database
7171
$this->dbCharset = $conf["mysql"]["charset"];
7272
$this->dbNewLink = false;
7373
$this->dbClientFlags = null;
74+
}
7475

76+
public function __destruct() {
77+
if($this->_iConnId) mysqli_close($this->_iConnId);
78+
}
79+
80+
private function connect() {
81+
if($this->_iConnId) return true;
82+
7583
$this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass);
7684
$try = 0;
7785
while((!is_object($this->_iConnId) || mysqli_connect_error()) && $try < 5) {
@@ -94,11 +102,7 @@ public function __construct($host = NULL , $user = NULL, $pass = NULL, $database
94102

95103
$this->_setCharset();
96104
}
97-
98-
public function __destruct() {
99-
if($this->_iConnId) mysqli_close($this->_iConnId);
100-
}
101-
105+
102106
public function close() {
103107
if($this->_iConnId) mysqli_close($this->_iConnId);
104108
$this->_iConnId = null;
@@ -176,6 +180,8 @@ private function _setCharset() {
176180
private function _query($sQuery = '') {
177181
global $app;
178182

183+
$this->connect();
184+
179185
//if($this->isConnected == false) return false;
180186
if ($sQuery == '') {
181187
$this->_sqlerror('Keine Anfrage angegeben / No query given');

0 commit comments

Comments
 (0)