From f507c00826fde7d701c1d4981392e6beea5341ef Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Fri, 29 Jan 2010 14:43:26 +0000 Subject: [PATCH] Duplicate "definition" of $wgUser in same method Move $wgDBtype later so only obtained if needed (ie we haven't died before then) --- includes/api/ApiQueryWatchlist.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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' ); -- 2.20.1