Use Horde_Db_Adapter_Mysql if the phptype is mysql but PDO_MySQL isn't available.
authorChuck Hagenbuch <chuck@bluestatedigital.com>
Mon, 5 Jul 2010 20:10:10 +0000 (16:10 -0400)
committerChuck Hagenbuch <chuck@bluestatedigital.com>
Mon, 5 Jul 2010 20:10:10 +0000 (16:10 -0400)
framework/Core/lib/Horde/Core/Factory/Db.php

index 41fd7af..5cf05bc 100644 (file)
@@ -121,9 +121,17 @@ class Horde_Core_Factory_Db
             if ($config['phptype'] == 'oci8') {
                 $config['phptype'] = 'oci';
             }
-            $config['adapter'] = ($config['phptype'] == 'mysqli')
-                ? 'mysqli'
-                : 'pdo_' . $config['phptype'];
+            if ($config['phptype'] == 'mysqli') {
+                $config['adapter'] = 'mysqli';
+            } elseif ($config['phptype'] == 'mysql') {
+                if (extension_loaded('pdo_mysql')) {
+                    $config['adapter'] = 'pdo_mysql';
+                } else {
+                    $config['adapter'] = 'mysql';
+                }
+            } else {
+                $config['adapter'] = 'pdo_' . $config['phptype'];
+            }
         }
 
         if (!empty($config['hostspec'])) {