From: Sam Reed Date: Fri, 29 Jan 2010 17:34:32 +0000 (+0000) Subject: Followup r61663 per Chads comment. Move $db declaration earlier, use $db->getType() X-Git-Tag: 1.31.0-rc.0~38052 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=3f5a6282216ac754378e7c9c07bf3d18fd9c7025;p=lhc%2Fweb%2Fwiklou.git Followup r61663 per Chads comment. Move $db declaration earlier, use $db->getType() Remove now unused global --- 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...