|
@@ -148,13 +148,18 @@ class Organizr
|
|
|
$this->checkIfUserIsBlacklisted();
|
|
$this->checkIfUserIsBlacklisted();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function __destruct()
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->disconnectDB();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
protected function connectDB()
|
|
protected function connectDB()
|
|
|
{
|
|
{
|
|
|
if ($this->hasDB()) {
|
|
if ($this->hasDB()) {
|
|
|
try {
|
|
try {
|
|
|
$connect = [
|
|
$connect = [
|
|
|
'driver' => 'sqlite3',
|
|
'driver' => 'sqlite3',
|
|
|
- 'database' => $this->config['dbLocation'] . $this->config['dbName'],
|
|
|
|
|
|
|
+ 'database' => $this->config['dbLocation'] . $this->config['dbName']
|
|
|
];
|
|
];
|
|
|
$this->db = new Connection($connect);
|
|
$this->db = new Connection($connect);
|
|
|
} catch (Dibi\Exception $e) {
|
|
} catch (Dibi\Exception $e) {
|
|
@@ -165,6 +170,13 @@ class Organizr
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function disconnectDB()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->hasDB()) {
|
|
|
|
|
+ $this->db->disconnect();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function connectOtherDB($file = null)
|
|
public function connectOtherDB($file = null)
|
|
|
{
|
|
{
|
|
|
$file = $file ?? $this->config['dbLocation'] . 'tempMigration.db';
|
|
$file = $file ?? $this->config['dbLocation'] . 'tempMigration.db';
|