r81244 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81243‎ | r81244 | r81245 >
Date:12:34, 31 January 2011
Author:reedy
Status:ok
Tags:
Comment:
bug 27041, swap Database::newFromParams to DatabaseBase::newFromType()
Modified paths:
  • /trunk/extensions/Asksql/Asksql_body.php (modified) (history)
  • /trunk/extensions/WikiTrust/sql/create_db.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiTrust/sql/create_db.php
@@ -73,7 +73,7 @@
7474 // Load all of the MW files.
7575 include($mw_root."/maintenance/commandLine.inc");
7676
77 -global $wgDBserver, $wgDBname, $wgDBuser, $wgDBprefix, $wgCreateRevisionIndex;
 77+global $wgDBserver, $wgDBname, $wgDBtype, $wgDBuser, $wgDBprefix, $wgCreateRevisionIndex;
7878
7979 // Source the update scripts
8080 require($mw_root."/extensions/WikiTrust/includes/TrustUpdateScripts.inc");
@@ -103,7 +103,14 @@
104104 }
105105
106106 // We need root priveledges to do this.
107 -$db_root = Database::newFromParams($wgDBserver, $dba, $dba_pass, $wgDBname);
 107+$db_root = DatabaseBase::newFromType( $wgDBtype,
 108+ array(
 109+ 'host' => $wgDBserver,
 110+ 'user' => $dba,
 111+ 'password' => $dba_pass,
 112+ 'dbname' => $wgDBname
 113+ )
 114+);
108115
109116 if (!$do_remove){
110117 // Now do the actual creating of tables.
Index: trunk/extensions/Asksql/Asksql_body.php
@@ -84,15 +84,24 @@
8585 function doSubmit() {
8686 global $wgOut, $wgUser, $wgServer, $wgScript, $wgLang, $wgContLang;
8787 global $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname, $wgSqlTimeout;
 88+ global $wgDBtype;
8889
8990 # Use a limit, folks!
9091 $this->query = trim( $this->query );
9192 if ( preg_match( '/^SELECT/i', $this->query )
92 - and !preg_match( '/LIMIT/i', $this->query ) ) {
 93+ && !preg_match( '/LIMIT/i', $this->query ) ) {
9394 $this->query .= ' LIMIT 100';
9495 }
95 - $conn = Database::newFromParams( $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname );
9696
 97+ $conn = DatabaseBase::newFromType( $wgDBtype,
 98+ array(
 99+ 'host' => $wgDBserver,
 100+ 'user' => $wgDBsqluser,
 101+ 'password' => $wgDBsqlpassword,
 102+ 'dbname' => $wgDBname
 103+ )
 104+ );
 105+
97106 $this->logQuery( $this->query );
98107
99108 # Start timer, will kill the DB thread in $wgSqlTimeout seconds
@@ -117,7 +126,7 @@
118127 }
119128
120129 $a = array();
121 - while ( $s = $conn->fetchObject( $res ) ) {
 130+ foreach ( $res as $s ) {
122131 array_push( $a, $s );
123132 }
124133 $conn->freeResult( $res );

Follow-up revisions

RevisionCommit summaryAuthorDate
r81245bug 27041, kill Image::__constructreedy12:45, 31 January 2011
r81248bug 27041, SpecialPage:addPage is deprecated...reedy13:17, 31 January 2011
r813941.17: MFT r81026, r81116, r81155, r81201, r81204, r81205, r81220, r81235, r81...catrope15:33, 2 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81220Part of bug 27041, removing all calls to escapeLike in extensionsreedy22:34, 30 January 2011
r81241bug 27041, fixup usages of userMailer()reedy12:21, 31 January 2011
r81242Per bug 27041, remove calls to $dbr->immediateBegin();...reedy12:24, 31 January 2011
r81243bug 27041, replace call to SiteStats::admins() to SiteStats::numberingroup( '...reedy12:26, 31 January 2011

Status & tagging log