return self::$connected;
}
+ public static function reconnect() {
+ // This variable is only defined here again to prevent warning messages
+ // It is a local variable and should hopefully not interfere with the global one.
+ $a = new App(dirname(__DIR__));
+
+ // We have to the the variable to "null" to force a new connection
+ self::$db = null;
+ include '.htconfig.php';
+
+ $ret = self::connect($db_host, $db_user, $db_pass, $db_data);
+ unset($db_host, $db_user, $db_pass, $db_data);
+
+ return $ret;
+ }
+
+ /**
+ * 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
+ */
+ public static function get_db()
+ {
+ return self::$db;
+ }
+
/**
* @brief Returns the MySQL server version string
*