From 3f5a6282216ac754378e7c9c07bf3d18fd9c7025 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Fri, 29 Jan 2010 17:34:32 +0000 Subject: [PATCH] Followup r61663 per Chads comment. Move $db declaration earlier, use $db->getType() Remove now unused global --- includes/api/ApiQueryWatchlist.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 6848ba6eb8..9a13107d17 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -172,9 +172,10 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { if ( !is_null( $params['excludeuser'] ) ) $this->addWhere( 'rc_user_text != ' . $this->getDB()->addQuotes( $params['excludeuser'] ) ); - global $wgDBtype; + $db = $this->getDB(); + // 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' ); + $this->addWhereIf( "rc_timestamp > ''", !isset ( $params['start'] ) && !isset ( $params['end'] ) && $db->getType() == 'mysql' ); $this->addOption( 'LIMIT', $params['limit'] + 1 ); @@ -182,7 +183,6 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $count = 0; $res = $this->select( __METHOD__ ); - $db = $this->getDB(); while ( $row = $db->fetchObject( $res ) ) { if ( ++ $count > $params['limit'] ) { // We've reached the one extra which shows that there are additional pages to be had. Stop here... -- 2.20.1