* (bug 32786) Fix backwards compatibility for extensions using 1.17's Database::newFr...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 6 Dec 2011 22:37:38 +0000 (22:37 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 6 Dec 2011 22:37:38 +0000 (22:37 +0000)
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

index 0f39465..6bc5bba 100644 (file)
@@ -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: