Index: trunk/extensions/FlaggedRevs/api/ApiQueryOldreviewedpages.php |
— | — | @@ -41,6 +41,7 @@ |
42 | 42 | } |
43 | 43 | |
44 | 44 | private function run( $resultPageSet = null ) { |
| 45 | + global $wgUser; |
45 | 46 | $params = $this->extractRequestParams(); |
46 | 47 | |
47 | 48 | // Construct SQL Query |
— | — | @@ -55,6 +56,15 @@ |
56 | 57 | # is broken due to mysql unsigned int design. |
57 | 58 | $this->addWhere( 'GREATEST(page_len,rev_len)-LEAST(page_len,rev_len) <= '. |
58 | 59 | 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 | + } |
59 | 69 | $this->addWhereRange( |
60 | 70 | 'fp_pending_since', |
61 | 71 | $params['dir'], |
— | — | @@ -143,31 +153,27 @@ |
144 | 154 | ), |
145 | 155 | 'dir' => array ( |
146 | 156 | ApiBase::PARAM_DFLT => 'newer', |
147 | | - ApiBase::PARAM_TYPE => array ( |
148 | | - 'newer', |
149 | | - 'older' |
150 | | - ) |
| 157 | + ApiBase::PARAM_TYPE => array( 'newer', 'older' ) |
151 | 158 | ), |
152 | 159 | 'maxsize' => array ( |
153 | 160 | ApiBase::PARAM_TYPE => 'integer', |
154 | 161 | ApiBase::PARAM_DFLT => null, |
155 | 162 | ApiBase::PARAM_MIN => 0 |
156 | 163 | ), |
| 164 | + 'filterwatched' => array ( |
| 165 | + ApiBase::PARAM_DFLT => 'all', |
| 166 | + ApiBase::PARAM_TYPE => array( 'watched', 'all' ) |
| 167 | + ), |
157 | 168 | 'namespace' => array ( |
158 | 169 | ApiBase::PARAM_DFLT => |
159 | 170 | !$wgFlaggedRevsNamespaces ? |
160 | | - NS_MAIN : |
161 | | - $wgFlaggedRevsNamespaces[0], |
| 171 | + NS_MAIN : $wgFlaggedRevsNamespaces[0], |
162 | 172 | ApiBase::PARAM_TYPE => 'namespace', |
163 | 173 | ApiBase::PARAM_ISMULTI => true, |
164 | 174 | ), |
165 | 175 | 'filterredir' => array ( |
166 | 176 | ApiBase::PARAM_DFLT => 'all', |
167 | | - ApiBase::PARAM_TYPE => array ( |
168 | | - 'redirects', |
169 | | - 'nonredirects', |
170 | | - 'all' |
171 | | - ) |
| 177 | + ApiBase::PARAM_TYPE => array( 'redirects', 'nonredirects', 'all' ) |
172 | 178 | ), |
173 | 179 | 'limit' => array ( |
174 | 180 | ApiBase::PARAM_DFLT => 10, |
— | — | @@ -186,6 +192,7 @@ |
187 | 193 | 'namespace' => 'The namespaces to enumerate.', |
188 | 194 | 'filterredir' => 'How to filter for redirects.', |
189 | 195 | 'maxsize' => 'Maximum character count change size.', |
| 196 | + 'filterwatched' => 'How to filter for pages on your watchlist.', |
190 | 197 | 'limit' => 'How many total pages to return.', |
191 | 198 | 'dir' => array( |
192 | 199 | 'In which direction to list.', |