]> git.mxchange.org Git - friendica.git/commitdiff
DBA: The "connected" check for PDO didn't work.
authorMichael <heluecht@pirati.ca>
Sun, 29 Oct 2017 06:31:01 +0000 (06:31 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 29 Oct 2017 06:31:01 +0000 (06:31 +0000)
include/dba.php

index 42f0614c80a23fecb82233a106eaffdac77ff133..74e9d7c061dd3b62c8641e1a87257efcb1e58b75 100644 (file)
@@ -222,10 +222,15 @@ class dba {
        }
 
        public static function connected() {
+               $connected = false;
+
                switch (self::$driver) {
                        case 'pdo':
-                               // Not sure if this really is working like expected
-                               $connected = (self::$db->getAttribute(PDO::ATTR_CONNECTION_STATUS) != "");
+                               $r = dba::p("SELECT 1");
+                               if (dbm::is_result($r)) {
+                                       $row = dba::inArray($r);
+                                       $connected = ($row[0]['1'] == '1');
+                               }
                                break;
                        case 'mysqli':
                                $connected = self::$db->ping();