r90430 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90429‎ | r90430 | r90431 >
Date:07:00, 20 June 2011
Author:tstarling
Status:resolved (Comments)
Tags:
Comment:
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
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/includes/db/LoadBalancer.php (modified) (history)
  • /trunk/phase3/includes/extauth/MediaWiki.php (modified) (history)
  • /trunk/phase3/includes/extauth/vB.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignDBRepo.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstallerPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/Database.php
@@ -612,10 +612,10 @@
613613 *
614614 * @param $dbType String A possible DB type
615615 * @param $p Array An array of options to pass to the constructor.
616 - * Valid options are: host, user, password, dbname, flags, tableprefix
 616+ * Valid options are: host, user, password, dbName, flags, tablePrefix
617617 * @return DatabaseBase subclass or null
618618 */
619 - public final static function newFromType( $dbType, $p = array() ) {
 619+ public final static function factory( $dbType, $p = array() ) {
620620 $canonicalDBTypes = array(
621621 'mysql', 'postgres', 'sqlite', 'oracle', 'mssql', 'ibm_db2'
622622 );
@@ -627,9 +627,9 @@
628628 isset( $p['host'] ) ? $p['host'] : false,
629629 isset( $p['user'] ) ? $p['user'] : false,
630630 isset( $p['password'] ) ? $p['password'] : false,
631 - isset( $p['dbname'] ) ? $p['dbname'] : false,
 631+ isset( $p['dbName'] ) ? $p['dbName'] : false,
632632 isset( $p['flags'] ) ? $p['flags'] : 0,
633 - isset( $p['tableprefix'] ) ? $p['tableprefix'] : 'get from global'
 633+ isset( $p['tablePrefix'] ) ? $p['tablePrefix'] : 'get from global'
634634 );
635635 } else {
636636 return null;
Index: trunk/phase3/includes/db/LoadBalancer.php
@@ -669,7 +669,7 @@
670670
671671 # Create object
672672 wfDebug( "Connecting to $host $dbname...\n" );
673 - $db = DatabaseBase::newFromType( $server['type'], $server );
 673+ $db = DatabaseBase::factory( $server['type'], $server );
674674 if ( $db->isOpen() ) {
675675 wfDebug( "Connected to $host $dbname.\n" );
676676 } else {
Index: trunk/phase3/includes/filerepo/ForeignDBRepo.php
@@ -35,14 +35,14 @@
3636
3737 function getMasterDB() {
3838 if ( !isset( $this->dbConn ) ) {
39 - $this->dbConn = DatabaseBase::newFromType( $this->dbType,
 39+ $this->dbConn = DatabaseBase::factory( $this->dbType,
4040 array(
4141 'host' => $this->dbServer,
4242 'user' => $this->dbUser,
4343 'password' => $this->dbPassword,
44 - 'dbname' => $this->dbName,
 44+ 'dbName' => $this->dbName,
4545 'flags' => $this->dbFlags,
46 - 'tableprefix' => $this->tablePrefix
 46+ 'tablePrefix' => $this->tablePrefix
4747 )
4848 );
4949 }
Index: trunk/phase3/includes/installer/WebInstallerPage.php
@@ -417,7 +417,7 @@
418418
419419 $dbSupport = '';
420420 foreach( $this->parent->getDBTypes() as $type ) {
421 - $link = DatabaseBase::newFromType( $type )->getSoftwareLink();
 421+ $link = DatabaseBase::factory( $type )->getSoftwareLink();
422422 $dbSupport .= wfMsgNoTrans( "config-support-$type", $link ) . "\n";
423423 }
424424 $this->addHTML( $this->parent->getInfoBox(
Index: trunk/phase3/includes/extauth/MediaWiki.php
@@ -89,13 +89,13 @@
9090 private function initFromCond( $cond ) {
9191 global $wgExternalAuthConf;
9292
93 - $this->mDb = DatabaseBase::newFromType( $wgExternalAuthConf['DBtype'],
 93+ $this->mDb = DatabaseBase::factory( $wgExternalAuthConf['DBtype'],
9494 array(
9595 'host' => $wgExternalAuthConf['DBserver'],
9696 'user' => $wgExternalAuthConf['DBuser'],
9797 'password' => $wgExternalAuthConf['DBpassword'],
98 - 'dbname' => $wgExternalAuthConf['DBname'],
99 - 'tableprefix' => $wgExternalAuthConf['DBprefix'],
 98+ 'dbName' => $wgExternalAuthConf['DBname'],
 99+ 'tablePrefix' => $wgExternalAuthConf['DBprefix'],
100100 )
101101 );
102102
Index: trunk/phase3/includes/extauth/vB.php
@@ -33,8 +33,8 @@
3434 * 'server' => 'localhost',
3535 * 'username' => 'forum',
3636 * 'password' => 'udE,jSqDJ<""p=fI.K9',
37 - * 'dbname' => 'forum',
38 - * 'tableprefix' => '',
 37+ * 'dbName' => 'forum',
 38+ * 'tablePrefix' => '',
3939 * 'cookieprefix' => 'bb'
4040 * );
4141 *
@@ -107,9 +107,9 @@
108108 $wgExternalAuthConf['server'],
109109 $wgExternalAuthConf['username'],
110110 $wgExternalAuthConf['password'],
111 - $wgExternalAuthConf['dbname'],
 111+ $wgExternalAuthConf['dbName'],
112112 0,
113 - $wgExternalAuthConf['tableprefix']
 113+ $wgExternalAuthConf['tablePrefix']
114114 );
115115 }
116116

Follow-up revisions

RevisionCommit summaryAuthorDate
r90435Revert the dbname -> dbName part of r90430. dbname actually dates back to r32...tstarling07:40, 20 June 2011
r105372* (bug 32786) Fix backwards compatibility for extensions using 1.17's Databas...brion22:37, 6 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80864Followup to r79848 (and really, make it useful...)...demon16:31, 24 January 2011

Comments

#Comment by Solitarius (talk | contribs)   21:09, 3 December 2011

The change to the api (released with 1.18) break the extension ExternalData and may disturb the extensions Asksql, SQL2Wiki and WikiTrust.

#Comment by Solitarius (talk | contribs)   21:51, 3 December 2011
#Comment by Brion VIBBER (talk | contribs)   22:40, 6 December 2011

r105372 adds a compat function, based on Solitarius's patch above.

Status & tagging log