Index: trunk/phase3/includes/api/ApiQueryAllLinks.php |
— | — | @@ -66,6 +66,18 @@ |
67 | 67 | |
68 | 68 | $this->addTables('pagelinks'); |
69 | 69 | $this->addWhereFld('pl_namespace', $params['namespace']); |
| 70 | + |
| 71 | + if (!is_null($params['from']) && !is_null($params['continue'])) |
| 72 | + $this->dieUsage('alcontinue and alfrom cannot be used together', 'params'); |
| 73 | + if (!is_null($params['continue'])) |
| 74 | + { |
| 75 | + $arr = explode('|', $params['continue']); |
| 76 | + if(count($arr) != 2) |
| 77 | + $this->dieUsage("Invalid continue parameter", 'badcontinue'); |
| 78 | + $params['from'] = $arr[0]; // Handled later |
| 79 | + $id = intval($arr[1]); |
| 80 | + $this->addWhere("pl_from >= $id"); |
| 81 | + } |
70 | 82 | |
71 | 83 | if (!is_null($params['from'])) |
72 | 84 | $this->addWhere('pl_title>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from']))); |
— | — | @@ -75,9 +87,9 @@ |
76 | 88 | if (is_null($resultPageSet)) { |
77 | 89 | $this->addFields(array ( |
78 | 90 | 'pl_namespace', |
79 | | - 'pl_title' |
| 91 | + 'pl_title', |
| 92 | + 'pl_from' |
80 | 93 | )); |
81 | | - $this->addFieldsIf('pl_from', $fld_ids); |
82 | 94 | } else { |
83 | 95 | $this->addFields('pl_from'); |
84 | 96 | $pageids = array(); |
— | — | @@ -86,7 +98,7 @@ |
87 | 99 | $this->addOption('USE INDEX', 'pl_namespace'); |
88 | 100 | $limit = $params['limit']; |
89 | 101 | $this->addOption('LIMIT', $limit+1); |
90 | | - $this->addOption('ORDER BY', 'pl_namespace, pl_title'); |
| 102 | + $this->addOption('ORDER BY', 'pl_title'); |
91 | 103 | |
92 | 104 | $res = $this->select(__METHOD__); |
93 | 105 | |
— | — | @@ -96,7 +108,7 @@ |
97 | 109 | if (++ $count > $limit) { |
98 | 110 | // We've reached the one extra which shows that there are additional pages to be had. Stop here... |
99 | 111 | // TODO: Security issue - if the user has no right to view next title, it will still be shown |
100 | | - $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->pl_title)); |
| 112 | + $this->setContinueEnumParameter('continue', ApiQueryBase :: keyToTitle($row->pl_title) . "|" . $row->pl_from); |
101 | 113 | break; |
102 | 114 | } |
103 | 115 | |
— | — | @@ -127,6 +139,7 @@ |
128 | 140 | |
129 | 141 | public function getAllowedParams() { |
130 | 142 | return array ( |
| 143 | + 'continue' => null, |
131 | 144 | 'from' => null, |
132 | 145 | 'prefix' => null, |
133 | 146 | 'unique' => false, |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -314,6 +314,7 @@ |
315 | 315 | * (bug 13945) Retrieve cascading protection sources via inprop=protection |
316 | 316 | * (bug 13965) Hardcoded 51 limit on titles is too limiting |
317 | 317 | * (bug 13993) apfrom doesn't work with apdir=descending |
| 318 | +* (bug 14018) Introduced alcontinue to list=alllinks to improve paging |
318 | 319 | |
319 | 320 | === Languages updated in 1.13 === |
320 | 321 | |