From: Brion Vibber Date: Tue, 6 Dec 2011 22:37:38 +0000 (+0000) Subject: * (bug 32786) Fix backwards compatibility for extensions using 1.17's Database::newFr... X-Git-Tag: 1.31.0-rc.0~26150 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=e4ea0fa287e3d4324dca6108f6a852390920dbdd;p=lhc%2Fweb%2Fwiklou.git * (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. --- 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: