r60520 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60519‎ | r60520 | r60521 >
Date:01:38, 31 December 2009
Author:aaron
Status:ok
Tags:
Comment:
* Added category filter to oldreviewedpages API (bug 14345)
* Fixed type for API type in unreviewedpages
* Fixed $this->category check
Modified paths:
  • /trunk/extensions/FlaggedRevs/api/ApiQueryOldreviewedpages.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/api/ApiQueryUnreviewedpages.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
@@ -379,7 +379,7 @@
380380 $conds['fpc_override'] = 1;
381381 }
382382 # Filter by category
383 - if( $this->category ) {
 383+ if( $this->category != '' ) {
384384 $tables[] = 'categorylinks';
385385 $conds[] = 'cl_from = fpp_page_id';
386386 $conds['cl_to'] = $this->category;
Index: trunk/extensions/FlaggedRevs/api/ApiQueryOldreviewedpages.php
@@ -47,6 +47,7 @@
4848 // Construct SQL Query
4949 $this->addTables( array( 'page', 'flaggedpages', 'revision' ) );
5050 $this->addWhereFld( 'page_namespace', $params['namespace'] );
 51+ $useIndex = array( 'flaggedpages' => 'fp_pending_since' );
5152 if( $params['filterredir'] == 'redirects' )
5253 $this->addWhereFld( 'page_is_redirect', 1 );
5354 if( $params['filterredir'] == 'nonredirects' )
@@ -65,6 +66,12 @@
6667 $this->addWhere( 'page_namespace = wl_namespace' );
6768 $this->addWhere( 'page_title = wl_title' );
6869 }
 70+ if( $params['category'] != '' ) {
 71+ $this->addTables( 'categorylinks' );
 72+ $this->addWhere( 'cl_from = fp_page_id' );
 73+ $this->addWhereFld( 'cl_to', $params['category'] );
 74+ $useIndex['categorylinks'] = 'cl_from';
 75+ }
6976 $this->addWhereRange(
7077 'fp_pending_since',
7178 $params['dir'],
@@ -76,10 +83,7 @@
7784 if ( !isset( $params['start'] ) && !isset( $params['end'] ) )
7885 $this->addWhere( 'fp_pending_since IS NOT NULL' );
7986
80 - $this->addOption(
81 - 'USE INDEX',
82 - array( 'flaggedpages' => 'fp_pending_since' )
83 - );
 87+ $this->addOption( 'USE INDEX', $useIndex );
8488
8589 if ( is_null( $resultPageSet ) ) {
8690 $this->addFields( array (
@@ -170,6 +174,9 @@
171175 ApiBase::PARAM_TYPE => 'namespace',
172176 ApiBase::PARAM_ISMULTI => true,
173177 ),
 178+ 'category' => array(
 179+ ApiBase::PARAM_TYPE => 'string'
 180+ ),
174181 'filterredir' => array (
175182 ApiBase::PARAM_DFLT => 'all',
176183 ApiBase::PARAM_TYPE => array( 'redirects', 'nonredirects', 'all' )
@@ -191,6 +198,7 @@
192199 'namespace' => 'The namespaces to enumerate.',
193200 'filterredir' => 'How to filter for redirects.',
194201 'maxsize' => 'Maximum character count change size.',
 202+ 'category' => 'Show pages only in the given category.',
195203 'filterwatched' => 'How to filter for pages on your watchlist.',
196204 'limit' => 'How many total pages to return.',
197205 'dir' => array(
Index: trunk/extensions/FlaggedRevs/api/ApiQueryUnreviewedpages.php
@@ -118,7 +118,7 @@
119119 $namespaces = FlaggedRevs::getReviewNamespaces();
120120 return array (
121121 'start' => array (
122 - ApiBase::PARAM_TYPE => 'sring'
 122+ ApiBase::PARAM_TYPE => 'string'
123123 ),
124124 'end' => array (
125125 ApiBase::PARAM_TYPE => 'string'

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r59533* (bug 14345) Added maxsize to oldreviewedpages API...aaron23:00, 28 November 2009
r59538* Added filterwatched to olreviewedpages API (bug 14345)...aaron00:29, 29 November 2009

Status & tagging log