From: Sam Reed Date: Fri, 29 Jan 2010 14:43:26 +0000 (+0000) Subject: Duplicate "definition" of $wgUser in same method X-Git-Tag: 1.31.0-rc.0~38056 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=f507c00826fde7d701c1d4981392e6beea5341ef;p=lhc%2Fweb%2Fwiklou.git Duplicate "definition" of $wgUser in same method Move $wgDBtype later so only obtained if needed (ie we haven't died before then) --- diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index aea14ed209..6848ba6eb8 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -52,7 +52,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $fld_timestamp = false, $fld_user = false, $fld_comment = false, $fld_sizes = false; private function run( $resultPageSet = null ) { - global $wgUser, $wgDBtype; + global $wgUser; $this->selectNamedDB( 'watchlist', DB_SLAVE, 'watchlist' ); @@ -150,9 +150,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->dieUsage( "Incorrect parameter - mutually exclusive values may not be supplied", 'show' ); } - // Check permissions. FIXME: should this check $user instead of - // $wgUser? - global $wgUser; + // Check permissions. FIXME: should this check $user instead of $wgUser? if ( ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) && !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() ) $this->dieUsage( "You need the patrol right to request the patrolled flag", 'permissiondenied' ); @@ -174,7 +172,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { if ( !is_null( $params['excludeuser'] ) ) $this->addWhere( 'rc_user_text != ' . $this->getDB()->addQuotes( $params['excludeuser'] ) ); - + global $wgDBtype; // This is an index optimization for mysql, as done in the Special:Watchlist page $this->addWhereIf( "rc_timestamp > ''", !isset ( $params['start'] ) && !isset ( $params['end'] ) && $wgDBtype == 'mysql' );