Fixes for r80864 for 1.18 backport:
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 20 Jun 2011 07:00:50 +0000 (07:00 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 20 Jun 2011 07:00:50 +0000 (07:00 +0000)
* Use camel case in tableName and dbName, dontrunallyourwordstogetherlikethis
* Call the function factory() instead of newFromType(), for consistency with the rest of MediaWiki

includes/db/Database.php
includes/db/LoadBalancer.php
includes/extauth/MediaWiki.php
includes/extauth/vB.php
includes/filerepo/ForeignDBRepo.php
includes/installer/WebInstallerPage.php

index 623dbc6..c925b76 100644 (file)
@@ -612,10 +612,10 @@ abstract class DatabaseBase implements DatabaseType {
         *
         * @param $dbType String A possible DB type
         * @param $p Array An array of options to pass to the constructor.
-        *    Valid options are: host, user, password, dbname, flags, tableprefix
+        *    Valid options are: host, user, password, dbName, flags, tablePrefix
         * @return DatabaseBase subclass or null
         */
-       public final static function newFromType( $dbType, $p = array() ) {
+       public final static function factory( $dbType, $p = array() ) {
                $canonicalDBTypes = array(
                        'mysql', 'postgres', 'sqlite', 'oracle', 'mssql', 'ibm_db2'
                );
@@ -627,9 +627,9 @@ abstract class DatabaseBase implements DatabaseType {
                                isset( $p['host'] ) ? $p['host'] : false,
                                isset( $p['user'] ) ? $p['user'] : false,
                                isset( $p['password'] ) ? $p['password'] : false,
-                               isset( $p['dbname'] ) ? $p['dbname'] : false,
+                               isset( $p['dbName'] ) ? $p['dbName'] : false,
                                isset( $p['flags'] ) ? $p['flags'] : 0,
-                               isset( $p['tableprefix'] ) ? $p['tableprefix'] : 'get from global'
+                               isset( $p['tablePrefix'] ) ? $p['tablePrefix'] : 'get from global'
                        );
                } else {
                        return null;
index 4ab044e..10fbf9a 100644 (file)
@@ -669,7 +669,7 @@ class LoadBalancer {
 
                # Create object
                wfDebug( "Connecting to $host $dbname...\n" );
-               $db = DatabaseBase::newFromType( $server['type'], $server );
+               $db = DatabaseBase::factory( $server['type'], $server );
                if ( $db->isOpen() ) {
                        wfDebug( "Connected to $host $dbname.\n" );
                } else {
index 84c8705..062d590 100644 (file)
@@ -89,13 +89,13 @@ class ExternalUser_MediaWiki extends ExternalUser {
        private function initFromCond( $cond ) {
                global $wgExternalAuthConf;
 
-               $this->mDb = DatabaseBase::newFromType( $wgExternalAuthConf['DBtype'],
+               $this->mDb = DatabaseBase::factory( $wgExternalAuthConf['DBtype'],
                        array(
                                'host'        => $wgExternalAuthConf['DBserver'],
                                'user'        => $wgExternalAuthConf['DBuser'],
                                'password'    => $wgExternalAuthConf['DBpassword'],
-                               'dbname'      => $wgExternalAuthConf['DBname'],
-                               'tableprefix' => $wgExternalAuthConf['DBprefix'],
+                               'dbName'      => $wgExternalAuthConf['DBname'],
+                               'tablePrefix' => $wgExternalAuthConf['DBprefix'],
                        )
                );
 
index 2793a28..ff0dcb5 100644 (file)
@@ -33,8 +33,8 @@
  *       'server' => 'localhost',
  *       'username' => 'forum',
  *       'password' => 'udE,jSqDJ<""p=fI.K9',
- *       'dbname' => 'forum',
- *       'tableprefix' => '',
+ *       'dbName' => 'forum',
+ *       'tablePrefix' => '',
  *       'cookieprefix' => 'bb'
  *   );
  *
@@ -107,9 +107,9 @@ class ExternalUser_vB extends ExternalUser {
                        $wgExternalAuthConf['server'],
                        $wgExternalAuthConf['username'],
                        $wgExternalAuthConf['password'],
-                       $wgExternalAuthConf['dbname'],
+                       $wgExternalAuthConf['dbName'],
                        0,
-                       $wgExternalAuthConf['tableprefix']
+                       $wgExternalAuthConf['tablePrefix']
                );
        }
 
index a756703..8791137 100644 (file)
@@ -35,14 +35,14 @@ class ForeignDBRepo extends LocalRepo {
 
        function getMasterDB() {
                if ( !isset( $this->dbConn ) ) {
-                       $this->dbConn = DatabaseBase::newFromType( $this->dbType,
+                       $this->dbConn = DatabaseBase::factory( $this->dbType,
                                array(
                                        'host' => $this->dbServer,
                                        'user'   => $this->dbUser,
                                        'password' => $this->dbPassword,
-                                       'dbname' => $this->dbName,
+                                       'dbName' => $this->dbName,
                                        'flags' => $this->dbFlags,
-                                       'tableprefix' => $this->tablePrefix
+                                       'tablePrefix' => $this->tablePrefix
                                )
                        );
                }
index 9b303c8..f0ae6ba 100644 (file)
@@ -417,7 +417,7 @@ class WebInstaller_DBConnect extends WebInstallerPage {
 
                $dbSupport = '';
                foreach( $this->parent->getDBTypes() as $type ) {
-                       $link = DatabaseBase::newFromType( $type )->getSoftwareLink();
+                       $link = DatabaseBase::factory( $type )->getSoftwareLink();
                        $dbSupport .= wfMsgNoTrans( "config-support-$type", $link ) . "\n";
                }
                $this->addHTML( $this->parent->getInfoBox(