Index: trunk/phase3/includes/api/ApiQueryRevisions.php |
— | — | @@ -208,6 +208,10 @@ |
209 | 209 | // Get all revision IDs |
210 | 210 | $this->addWhereFld('rev_id', array_keys($revs)); |
211 | 211 | |
| 212 | + if(!is_null($params['continue'])) |
| 213 | + $this->addWhere("rev_id >= '" . intval($params['continue']) . "'"); |
| 214 | + $this->addOption('ORDER BY', 'rev_id'); |
| 215 | + |
212 | 216 | // assumption testing -- we should never get more then $revCount rows. |
213 | 217 | $limit = $revCount; |
214 | 218 | } |
— | — | @@ -225,14 +229,26 @@ |
226 | 230 | // Get all page IDs |
227 | 231 | $this->addWhereFld('page_id', array_keys($titles)); |
228 | 232 | |
| 233 | + if(!is_null($params['continue'])) |
| 234 | + { |
| 235 | + $cont = explode('|', $params['continue']); |
| 236 | + if(count($cont) != 2) |
| 237 | + $this->dieUsage("Invalid continue param. You should pass the original " . |
| 238 | + "value returned by the previous query", "_badcontinue"); |
| 239 | + $pageid = intval($cont[0]); |
| 240 | + $revid = intval($cont[1]); |
| 241 | + $this->addWhere("rev_page > '$pageid' OR " . |
| 242 | + "(rev_page = '$pageid' AND " . |
| 243 | + "rev_id >= '$revid')"); |
| 244 | + } |
| 245 | + $this->addOption('ORDER BY', 'rev_page, rev_id'); |
| 246 | + |
229 | 247 | // assumption testing -- we should never get more then $pageCount rows. |
230 | 248 | $limit = $pageCount; |
231 | 249 | } else |
232 | 250 | ApiBase :: dieDebug(__METHOD__, 'param validation?'); |
233 | 251 | |
234 | 252 | $this->addOption('LIMIT', $limit +1); |
235 | | - if(!is_null($params['continue'])) |
236 | | - $this->addOption('OFFSET', $params['continue']); |
237 | 253 | |
238 | 254 | $data = array (); |
239 | 255 | $count = 0; |
— | — | @@ -255,8 +271,11 @@ |
256 | 272 | { |
257 | 273 | if($enumRevMode) |
258 | 274 | $this->setContinueEnumParameter('startid', intval($row->rev_id)); |
| 275 | + else if($revCount > 0) |
| 276 | + $this->setContinueEnumParameter('continue', intval($row->rev_id)); |
259 | 277 | else |
260 | | - $this->setContinueEnumParameter('continue', $params['continue'] + $count - 1); |
| 278 | + $this->setContinueEnumParameter('continue', intval($row->rev_page) . |
| 279 | + '|' . intval($row->rev_id)); |
261 | 280 | break; |
262 | 281 | } |
263 | 282 | } |