Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php |
— | — | @@ -64,11 +64,11 @@ |
65 | 65 | $fld_sortkey = isset($prop['sortkey']); |
66 | 66 | |
67 | 67 | if (is_null($resultPageSet)) { |
68 | | - $this->addFields(array('cl_sortkey', 'page_namespace', 'page_title')); |
| 68 | + $this->addFields(array('cl_from', 'cl_sortkey', 'page_namespace', 'page_title')); |
69 | 69 | $this->addFieldsIf('page_id', $fld_ids); |
70 | 70 | } else { |
71 | 71 | $this->addFields($resultPageSet->getPageTableFields()); // will include page_ id, ns, title |
72 | | - $this->addFields('cl_sortkey'); |
| 72 | + $this->addFields(array('cl_from', 'cl_sortkey')); |
73 | 73 | } |
74 | 74 | |
75 | 75 | $this->addTables(array('page','categorylinks')); // must be in this order for 'USE INDEX' |
— | — | @@ -139,18 +139,24 @@ |
140 | 140 | return; // This is not a continuation request |
141 | 141 | |
142 | 142 | $continueList = explode('|', $continue); |
143 | | - if (count($continueList) != 2) |
| 143 | + $hasError = count($continueList) != 2; |
| 144 | + $from = 0; |
| 145 | + if (!$hasError && strlen($continueList[1]) > 0) { |
| 146 | + $from = intval($continueList[1]); |
| 147 | + $hasError = ($from == 0); |
| 148 | + } |
| 149 | + |
| 150 | + if ($hasError) |
144 | 151 | $this->dieUsage("Invalid continue param. You should pass the original value returned by the previous query", "badcontinue"); |
145 | 152 | |
146 | 153 | $sortKey = $this->getDB()->addQuotes($continueList[0]); |
147 | | - $from = intval($continueList[1]); |
148 | 154 | |
149 | 155 | if ($from != 0) { |
150 | 156 | // Duplicate sort key continue |
151 | 157 | $this->addWhere( "cl_sortkey>$sortKey OR (cl_sortkey=$sortKey AND cl_from>=$from)" ); |
152 | 158 | } else { |
153 | 159 | $this->addWhere( "cl_sortkey>=$sortKey" ); |
154 | | - } |
| 160 | + } |
155 | 161 | } |
156 | 162 | |
157 | 163 | protected function getAllowedParams() { |
— | — | @@ -183,7 +189,7 @@ |
184 | 190 | protected function getParamDescription() { |
185 | 191 | return array ( |
186 | 192 | 'category' => 'Which category to enumerate (required)', |
187 | | - 'prop' => 'What pieces of infromation to include', |
| 193 | + 'prop' => 'What pieces of information to include', |
188 | 194 | 'namespace' => 'Only include pages in these namespaces', |
189 | 195 | 'continue' => 'For large categories, give the value retured from previous query', |
190 | 196 | 'limit' => 'The maximum number of pages to return.', |