mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Close the mysqli connection when deleting the class.
This commit is contained in:
parent
2beb1631a5
commit
912cda9a1e
@ -67,7 +67,7 @@ class MySQLDatabase extends SS_Database {
|
|||||||
} else {
|
} else {
|
||||||
$this->dbConn = new MySQLi($parameters['server'], $parameters['username'], $parameters['password']);
|
$this->dbConn = new MySQLi($parameters['server'], $parameters['username'], $parameters['password']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->dbConn->connect_error) {
|
if($this->dbConn->connect_error) {
|
||||||
$this->databaseError("Couldn't connect to MySQL database | " . $this->dbConn->connect_error);
|
$this->databaseError("Couldn't connect to MySQL database | " . $this->dbConn->connect_error);
|
||||||
}
|
}
|
||||||
@ -86,6 +86,12 @@ class MySQLDatabase extends SS_Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __destruct() {
|
||||||
|
if($this->dbConn) {
|
||||||
|
mysqli_close($this->dbConn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not implemented, needed for PDO
|
* Not implemented, needed for PDO
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user