]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into quit-on-error
authorMichael <heluecht@pirati.ca>
Mon, 11 Jun 2018 03:15:59 +0000 (03:15 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 11 Jun 2018 03:15:59 +0000 (03:15 +0000)
1  2 
include/dba.php

diff --cc include/dba.php
index f915d783734f0c03d232e4c5d2f030c77df4ba47,6b98f243e400998bbce63b28e66e1001b0df9c59..550fbe25578e6a284c026651074234ab1b1ea4a2
@@@ -104,21 -92,35 +94,50 @@@ echo "1"
                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
         *