From 8371ede86b9bb31efe7b8b77869329bcec0b48ac Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 20 Jun 2011 07:00:50 +0000 Subject: [PATCH] Fixes for r80864 for 1.18 backport: * 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 | 8 ++++---- includes/db/LoadBalancer.php | 2 +- includes/extauth/MediaWiki.php | 6 +++--- includes/extauth/vB.php | 8 ++++---- includes/filerepo/ForeignDBRepo.php | 6 +++--- includes/installer/WebInstallerPage.php | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index 623dbc6a05..c925b76aa5 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -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; diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 4ab044e6ea..10fbf9aa37 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -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 { diff --git a/includes/extauth/MediaWiki.php b/includes/extauth/MediaWiki.php index 84c8705a0a..062d5903e7 100644 --- a/includes/extauth/MediaWiki.php +++ b/includes/extauth/MediaWiki.php @@ -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'], ) ); diff --git a/includes/extauth/vB.php b/includes/extauth/vB.php index 2793a28662..ff0dcb58e4 100644 --- a/includes/extauth/vB.php +++ b/includes/extauth/vB.php @@ -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'] ); } diff --git a/includes/filerepo/ForeignDBRepo.php b/includes/filerepo/ForeignDBRepo.php index a756703f34..879113724a 100644 --- a/includes/filerepo/ForeignDBRepo.php +++ b/includes/filerepo/ForeignDBRepo.php @@ -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 ) ); } diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 9b303c8e2b..f0ae6ba66e 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -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( -- 2.20.1