From e4ea0fa287e3d4324dca6108f6a852390920dbdd Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 6 Dec 2011 22:37:38 +0000 Subject: [PATCH] * (bug 32786) Fix backwards compatibility for extensions using 1.17's Database::newFromType() Patch based on https://bugzilla.wikimedia.org/attachment.cgi?id=9604 by Solitarius -- thanks! Added a conversion for a changed tablePrefix / tableprefix bit. --- includes/db/Database.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/includes/db/Database.php b/includes/db/Database.php index 0f39465da2..6bc5bbad5d 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -635,6 +635,19 @@ abstract class DatabaseBase implements DatabaseType { return new DatabaseMysql( $server, $user, $password, $dbName, $flags ); } + /** + * Same as new factory( ... ), kept for backward compatibility + * @deprecated since 1.18 + * @see Database::factory() + */ + public final static function newFromType( $dbType, $p = array() ) { + wfDeprecated( __METHOD__ ); + if ( isset( $p['tableprefix'] ) ) { + $p['tablePrefix'] = $p['tableprefix']; + } + return self::factory( $dbType, $p ); + } + /** * Given a DB type, construct the name of the appropriate child class of * DatabaseBase. This is designed to replace all of the manual stuff like: -- 2.20.1