r61663 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61662‎ | r61663 | r61664 >
Date:14:43, 29 January 2010
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Duplicate "definition" of $wgUser in same method

Move $wgDBtype later so only obtained if needed (ie we haven't died before then)
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryWatchlist.php
@@ -52,7 +52,7 @@
5353 $fld_timestamp = false, $fld_user = false, $fld_comment = false, $fld_sizes = false;
5454
5555 private function run( $resultPageSet = null ) {
56 - global $wgUser, $wgDBtype;
 56+ global $wgUser;
5757
5858 $this->selectNamedDB( 'watchlist', DB_SLAVE, 'watchlist' );
5959
@@ -150,9 +150,7 @@
151151 $this->dieUsage( "Incorrect parameter - mutually exclusive values may not be supplied", 'show' );
152152 }
153153
154 - // Check permissions. FIXME: should this check $user instead of
155 - // $wgUser?
156 - global $wgUser;
 154+ // Check permissions. FIXME: should this check $user instead of $wgUser?
157155 if ( ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) && !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() )
158156 $this->dieUsage( "You need the patrol right to request the patrolled flag", 'permissiondenied' );
159157
@@ -174,7 +172,7 @@
175173 if ( !is_null( $params['excludeuser'] ) )
176174 $this->addWhere( 'rc_user_text != ' . $this->getDB()->addQuotes( $params['excludeuser'] ) );
177175
178 -
 176+ global $wgDBtype;
179177 // This is an index optimization for mysql, as done in the Special:Watchlist page
180178 $this->addWhereIf( "rc_timestamp > ''", !isset ( $params['start'] ) && !isset ( $params['end'] ) && $wgDBtype == 'mysql' );
181179

Follow-up revisions

RevisionCommit summaryAuthorDate
r61671Followup r61663 per Chads comment. Move $db declaration earlier, use $db->get...reedy17:34, 29 January 2010

Comments

#Comment by 😂 (talk | contribs)   15:51, 29 January 2010

Don't use $wgDBtype, use $db->getType().

#Comment by Reedy (talk | contribs)   16:38, 29 January 2010

Lol. Code was already there, i just moved it ;)

Status & tagging log