Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php |
— | — | @@ -128,6 +128,8 @@ |
129 | 129 | $token = $wgUser->editToken( '', $this->getMain()->getRequest() ); |
130 | 130 | } |
131 | 131 | |
| 132 | + $dir = $params['dir']; |
| 133 | + |
132 | 134 | // We need a custom WHERE clause that matches all titles. |
133 | 135 | if ( $mode == 'revs' ) { |
134 | 136 | $lb = new LinkBatch( $titles ); |
— | — | @@ -135,10 +137,10 @@ |
136 | 138 | $this->addWhere( $where ); |
137 | 139 | } elseif ( $mode == 'all' ) { |
138 | 140 | $this->addWhereFld( 'ar_namespace', $params['namespace'] ); |
139 | | - if ( !is_null( $params['from'] ) ) { |
140 | | - $from = $this->getDB()->strencode( $this->titleToKey( $params['from'] ) ); |
141 | | - $this->addWhere( "ar_title >= '$from'" ); |
142 | | - } |
| 141 | + |
| 142 | + $from = is_null( $params['from'] ) ? null : $this->titleToKey( $params['from'] ); |
| 143 | + $to = is_null( $params['to'] ) ? null : $this->titleToKey( $params['to'] ); |
| 144 | + $this->addWhereRange( 'ar_title', $dir, $from, $to ); |
143 | 145 | } |
144 | 146 | |
145 | 147 | if ( !is_null( $params['user'] ) ) { |
— | — | @@ -148,8 +150,7 @@ |
149 | 151 | $this->getDB()->addQuotes( $params['excludeuser'] ) ); |
150 | 152 | } |
151 | 153 | |
152 | | - if ( !is_null( $params['continue'] ) && ( $mode == 'all' || $mode == 'revs' ) ) |
153 | | - { |
| 154 | + if ( !is_null( $params['continue'] ) && ( $mode == 'all' || $mode == 'revs' ) ) { |
154 | 155 | $cont = explode( '|', $params['continue'] ); |
155 | 156 | if ( count( $cont ) != 3 ) { |
156 | 157 | $this->dieUsage( 'Invalid continue param. You should pass the original value returned by the previous query', 'badcontinue' ); |
— | — | @@ -157,7 +158,7 @@ |
158 | 159 | $ns = intval( $cont[0] ); |
159 | 160 | $title = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) ); |
160 | 161 | $ts = $this->getDB()->strencode( $cont[2] ); |
161 | | - $op = ( $params['dir'] == 'newer' ? '>' : '<' ); |
| 162 | + $op = ( $dir == 'newer' ? '>' : '<' ); |
162 | 163 | $this->addWhere( "ar_namespace $op $ns OR " . |
163 | 164 | "(ar_namespace = $ns AND " . |
164 | 165 | "(ar_title $op '$title' OR " . |
— | — | @@ -170,17 +171,16 @@ |
171 | 172 | if ( $mode == 'all' ) { |
172 | 173 | if ( $params['unique'] ) { |
173 | 174 | $this->addOption( 'GROUP BY', 'ar_title' ); |
174 | | - $this->addOption( 'ORDER BY', 'ar_title' ); |
175 | 175 | } else { |
176 | | - $this->addOption( 'ORDER BY', 'ar_title, ar_timestamp' ); |
| 176 | + $this->addOption( 'ORDER BY', 'ar_timestamp' ); |
177 | 177 | } |
178 | 178 | } else { |
179 | 179 | if ( $mode == 'revs' ) { |
180 | 180 | // Sort by ns and title in the same order as timestamp for efficiency |
181 | | - $this->addWhereRange( 'ar_namespace', $params['dir'], null, null ); |
182 | | - $this->addWhereRange( 'ar_title', $params['dir'], null, null ); |
| 181 | + $this->addWhereRange( 'ar_namespace', $dir, null, null ); |
| 182 | + $this->addWhereRange( 'ar_title', $dir, null, null ); |
183 | 183 | } |
184 | | - $this->addWhereRange( 'ar_timestamp', $params['dir'], $params['start'], $params['end'] ); |
| 184 | + $this->addWhereRange( 'ar_timestamp', $dir, $params['start'], $params['end'] ); |
185 | 185 | } |
186 | 186 | $res = $this->select( __METHOD__ ); |
187 | 187 | $pageMap = array(); // Maps ns&title to (fake) pageid |
— | — | @@ -273,6 +273,7 @@ |
274 | 274 | ApiBase::PARAM_DFLT => 'older' |
275 | 275 | ), |
276 | 276 | 'from' => null, |
| 277 | + 'to' => null, |
277 | 278 | 'continue' => null, |
278 | 279 | 'unique' => false, |
279 | 280 | 'user' => array( |
— | — | @@ -315,6 +316,8 @@ |
316 | 317 | 'start' => 'The timestamp to start enumerating from (1,2)', |
317 | 318 | 'end' => 'The timestamp to stop enumerating at (1,2)', |
318 | 319 | 'dir' => $this->getDirectionDescription( $this->getModulePrefix(), ' (1,2)' ), |
| 320 | + 'from' => 'Start listing at this title (3)', |
| 321 | + 'to' => 'Stop listing at this title (3)', |
319 | 322 | 'limit' => 'The maximum amount of revisions to list', |
320 | 323 | 'prop' => array( |
321 | 324 | 'Which properties to get', |
— | — | @@ -331,7 +334,6 @@ |
332 | 335 | 'namespace' => 'Only list pages in this namespace (3)', |
333 | 336 | 'user' => 'Only list revisions by this user', |
334 | 337 | 'excludeuser' => 'Don\'t list revisions by this user', |
335 | | - 'from' => 'Start listing at this title (3)', |
336 | 338 | 'continue' => 'When more results are available, use this to continue (3)', |
337 | 339 | 'unique' => 'List only one revision for each page (3)', |
338 | 340 | ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -251,6 +251,7 @@ |
252 | 252 | * (bug 27340) API: Allow listing of "small" categories |
253 | 253 | * (bug 27342) Add audir param to list=allusers |
254 | 254 | * (bug 27203) add fato param to list=filearchive |
| 255 | +* (bug 27341) Add drto param to list=deletedrevs |
255 | 256 | |
256 | 257 | === Languages updated in 1.18 === |
257 | 258 | |