r111446 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111445‎ | r111446 | r111447 >
Date:04:10, 14 February 2012
Author:reedy
Status:ok
Tags:
Comment:
Use DatabaseBase::factory

Remove unused globals/variables
Modified paths:
  • /trunk/extensions/Asksql/Asksql_body.php (modified) (history)
  • /trunk/extensions/ExternalData/ED_Utils.php (modified) (history)
  • /trunk/extensions/SQL2Wiki/SQL2Wiki.body.php (modified) (history)
  • /trunk/extensions/WikiTrust/sql/create_db.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SQL2Wiki/SQL2Wiki.body.php
@@ -87,7 +87,7 @@
8888 wfSuppressWarnings();
8989 $db = $wgExSql2WikiDatabases[$this->mArgs["database"]];
9090 $this->mDBType = $db['type'];
91 - $this->mDB = Database::newFromType( $this->mDBType, $db );
 91+ $this->mDB = DatabaseBase::factory( $this->mDBType, $db );
9292 wfRestoreWarnings();
9393 } catch ( Exception $ex) {
9494 $lastError = $ex->getMessage();
Index: trunk/extensions/WikiTrust/sql/create_db.php
@@ -103,7 +103,7 @@
104104 }
105105
106106 // We need root priveledges to do this.
107 -$db_root = DatabaseBase::newFromType( $wgDBtype,
 107+$db_root = DatabaseBase::factory( $wgDBtype,
108108 array(
109109 'host' => $wgDBserver,
110110 'user' => $dba,
Index: trunk/extensions/ExternalData/ED_Utils.php
@@ -184,9 +184,9 @@
185185
186186 // DatabaseBase::newFromType() was added in MW 1.17 - it was
187187 // then replaced by DatabaseBase::factory() in MW 1.18
188 - $factorFunction = array( 'DatabaseBase', 'factory' );
 188+ $factoryFunction = array( 'DatabaseBase', 'factory' );
189189 $newFromTypeFunction = array( 'DatabaseBase', 'newFromType' );
190 - if ( is_callable( $factorFunction ) ) {
 190+ if ( is_callable( $factoryFunction ) ) {
191191 $db = DatabaseBase::factory( $db_type,
192192 array(
193193 'host' => $db_server,
Index: trunk/extensions/Asksql/Asksql_body.php
@@ -13,8 +13,6 @@
1414 function execute( $par ) {
1515 global $wgAllowSysopQueries, $wgUser, $wgRequest, $wgOut;
1616
17 -
18 -
1917 if ( !$wgAllowSysopQueries ) {
2018 throw new ErrorPageError( 'nosuchspecialpage', 'nospecialpagetext' );
2119 }
@@ -52,7 +50,7 @@
5351 }
5452
5553 function showForm( $err ) {
56 - global $wgOut, $wgUser, $wgLang;
 54+ global $wgOut;
5755 global $wgLogQueries;
5856
5957 $wgOut->setPagetitle( wfMsg( 'asksql' ) );
@@ -82,8 +80,8 @@
8381 }
8482
8583 function doSubmit() {
86 - global $wgOut, $wgUser, $wgServer, $wgLang, $wgContLang;
87 - global $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname, $wgSqlTimeout;
 84+ global $wgOut, $wgUser, $wgContLang;
 85+ global $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname;
8886 global $wgDBtype;
8987
9088 # Use a limit, folks!
@@ -93,12 +91,12 @@
9492 $this->query .= ' LIMIT 100';
9593 }
9694
97 - $conn = DatabaseBase::newFromType( $wgDBtype,
 95+ $conn = DatabaseBase::factory( $wgDBtype,
9896 array(
99 - 'host' => $wgDBserver,
100 - 'user' => $wgDBsqluser,
101 - 'password' => $wgDBsqlpassword,
102 - 'dbname' => $wgDBname
 97+ 'host' => $wgDBserver,
 98+ 'user' => $wgDBsqluser,
 99+ 'password' => $wgDBsqlpassword,
 100+ 'dbname' => $wgDBname
103101 )
104102 );
105103
@@ -111,7 +109,6 @@
112110 # $conn->stopTimer();
113111 $this->logFinishedQuery();
114112
115 - $n = 0;
116113 @$n = $conn->numFields( $res );
117114 $titleList = false;
118115

Status & tagging log