r59538 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59537‎ | r59538 | r59539 >
Date:00:29, 29 November 2009
Author:aaron
Status:ok
Tags:
Comment:
* Added filterwatched to olreviewedpages API (bug 14345)
* Killed some whitespace
Modified paths:
  • /trunk/extensions/FlaggedRevs/api/ApiQueryOldreviewedpages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/api/ApiQueryOldreviewedpages.php
@@ -41,6 +41,7 @@
4242 }
4343
4444 private function run( $resultPageSet = null ) {
 45+ global $wgUser;
4546 $params = $this->extractRequestParams();
4647
4748 // Construct SQL Query
@@ -55,6 +56,15 @@
5657 # is broken due to mysql unsigned int design.
5758 $this->addWhere( 'GREATEST(page_len,rev_len)-LEAST(page_len,rev_len) <= '.
5859 intval($params['maxsize']) );
 60+ if( $params['filterwatched'] == 'watched' ) {
 61+ if( !($uid = $wgUser->getId()) ) {
 62+ $this->dieUsage('You must be logged-in to have a watchlist', 'notloggedin');
 63+ }
 64+ $this->addTables( 'watchlist' );
 65+ $this->addWhereFld( 'wl_user', $uid );
 66+ $this->addWhere( 'page_namespace = wl_namespace' );
 67+ $this->addWhere( 'page_title = wl_title' );
 68+ }
5969 $this->addWhereRange(
6070 'fp_pending_since',
6171 $params['dir'],
@@ -143,31 +153,27 @@
144154 ),
145155 'dir' => array (
146156 ApiBase::PARAM_DFLT => 'newer',
147 - ApiBase::PARAM_TYPE => array (
148 - 'newer',
149 - 'older'
150 - )
 157+ ApiBase::PARAM_TYPE => array( 'newer', 'older' )
151158 ),
152159 'maxsize' => array (
153160 ApiBase::PARAM_TYPE => 'integer',
154161 ApiBase::PARAM_DFLT => null,
155162 ApiBase::PARAM_MIN => 0
156163 ),
 164+ 'filterwatched' => array (
 165+ ApiBase::PARAM_DFLT => 'all',
 166+ ApiBase::PARAM_TYPE => array( 'watched', 'all' )
 167+ ),
157168 'namespace' => array (
158169 ApiBase::PARAM_DFLT =>
159170 !$wgFlaggedRevsNamespaces ?
160 - NS_MAIN :
161 - $wgFlaggedRevsNamespaces[0],
 171+ NS_MAIN : $wgFlaggedRevsNamespaces[0],
162172 ApiBase::PARAM_TYPE => 'namespace',
163173 ApiBase::PARAM_ISMULTI => true,
164174 ),
165175 'filterredir' => array (
166176 ApiBase::PARAM_DFLT => 'all',
167 - ApiBase::PARAM_TYPE => array (
168 - 'redirects',
169 - 'nonredirects',
170 - 'all'
171 - )
 177+ ApiBase::PARAM_TYPE => array( 'redirects', 'nonredirects', 'all' )
172178 ),
173179 'limit' => array (
174180 ApiBase::PARAM_DFLT => 10,
@@ -186,6 +192,7 @@
187193 'namespace' => 'The namespaces to enumerate.',
188194 'filterredir' => 'How to filter for redirects.',
189195 'maxsize' => 'Maximum character count change size.',
 196+ 'filterwatched' => 'How to filter for pages on your watchlist.',
190197 'limit' => 'How many total pages to return.',
191198 'dir' => array(
192199 'In which direction to list.',

Follow-up revisions

RevisionCommit summaryAuthorDate
r60520* Added category filter to oldreviewedpages API (bug 14345)...aaron01:38, 31 December 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r41809(bug 14345) Add API module for FlaggedRevs. Patch by Paul Copperman. I have N...catrope14:27, 7 October 2008
r59533* (bug 14345) Added maxsize to oldreviewedpages API...aaron23:00, 28 November 2009

Status & tagging log