From 6fb01643438a894c921e6fbcb57091ce20e6fae8 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Tue, 3 Jan 2012 19:55:45 +0000 Subject: [PATCH] Fix Bug 33384 - database drivers cannot be provided by extension Author: Adam Wight Love the simplicity of this fix. --- includes/db/Database.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index 02938727fe..57d98adf3d 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -675,9 +675,9 @@ abstract class DatabaseBase implements DatabaseType { 'mysql', 'postgres', 'sqlite', 'oracle', 'mssql', 'ibm_db2' ); $dbType = strtolower( $dbType ); + $class = 'Database' . ucfirst( $dbType ); if( in_array( $dbType, $canonicalDBTypes ) ) { - $class = 'Database' . ucfirst( $dbType ); return new $class( isset( $p['host'] ) ? $p['host'] : false, isset( $p['user'] ) ? $p['user'] : false, @@ -686,6 +686,8 @@ abstract class DatabaseBase implements DatabaseType { isset( $p['flags'] ) ? $p['flags'] : 0, isset( $p['tablePrefix'] ) ? $p['tablePrefix'] : 'get from global' ); + } elseif (class_exists($class)) { + return new $class($p); } else { return null; } -- 2.20.1