mirror of
https://github.com/friendica/friendica
synced 2025-04-25 23:50:11 +00:00
Force a database reconnection in the daemon to prevent lost connections
This commit is contained in:
parent
1355798584
commit
aa3f8ec09d
2 changed files with 33 additions and 4 deletions
|
@ -92,6 +92,26 @@ class dba {
|
|||
return self::$connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnects the current database connection
|
||||
*/
|
||||
public static function disconnect()
|
||||
{
|
||||
if (is_null(self::$db)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (self::$driver) {
|
||||
case 'pdo':
|
||||
self::$db = null;
|
||||
break;
|
||||
case 'mysqli':
|
||||
self::$db->close();
|
||||
self::$db = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the database object.
|
||||
* @return PDO|mysqli
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue