Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php |
— | — | @@ -135,7 +135,7 @@ |
136 | 136 | $this->addOption( 'LIMIT', $limit + 1 ); |
137 | 137 | |
138 | 138 | $count = 0; |
139 | | - $lastSortKey = null; |
| 139 | + $lastFrom = null; |
140 | 140 | $res = $this->select( __METHOD__ ); |
141 | 141 | foreach ( $res as $row ) { |
142 | 142 | if ( ++ $count > $limit ) { |
— | — | @@ -144,7 +144,7 @@ |
145 | 145 | if ( $params['sort'] == 'timestamp' ) { |
146 | 146 | $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->cl_timestamp ) ); |
147 | 147 | } else { |
148 | | - $this->setContinueEnumParameter( 'continue', $this->getContinueStr( $row, $lastSortKey ) ); |
| 148 | + $this->setContinueEnumParameter( 'continue', $lastFrom ); |
149 | 149 | } |
150 | 150 | break; |
151 | 151 | } |
— | — | @@ -181,14 +181,14 @@ |
182 | 182 | if ( $params['sort'] == 'timestamp' ) { |
183 | 183 | $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->cl_timestamp ) ); |
184 | 184 | } else { |
185 | | - $this->setContinueEnumParameter( 'continue', $this->getContinueStr( $row, $lastSortKey ) ); |
| 185 | + $this->setContinueEnumParameter( 'continue', $lastFrom ); |
186 | 186 | } |
187 | 187 | break; |
188 | 188 | } |
189 | 189 | } else { |
190 | 190 | $resultPageSet->processDbRow( $row ); |
191 | 191 | } |
192 | | - $lastSortKey = $row->cl_sortkey; // detect duplicate sortkeys |
| 192 | + $lastFrom = $row->cl_from; // detect duplicate sortkeys |
193 | 193 | } |
194 | 194 | |
195 | 195 | if ( is_null( $resultPageSet ) ) { |
— | — | @@ -197,14 +197,6 @@ |
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
201 | | - private function getContinueStr( $row, $lastSortKey ) { |
202 | | - $ret = $row->cl_sortkey . '|'; |
203 | | - if ( $row->cl_sortkey == $lastSortKey ) { // duplicate sort key, add cl_from |
204 | | - $ret .= $row->cl_from; |
205 | | - } |
206 | | - return $ret; |
207 | | - } |
208 | | - |
209 | 201 | /** |
210 | 202 | * Add DB WHERE clause to continue previous query based on 'continue' parameter |
211 | 203 | */ |
— | — | @@ -213,26 +205,11 @@ |
214 | 206 | return; // This is not a continuation request |
215 | 207 | } |
216 | 208 | |
217 | | - $pos = strrpos( $continue, '|' ); |
218 | | - $sortkey = substr( $continue, 0, $pos ); |
219 | | - $fromstr = substr( $continue, $pos + 1 ); |
220 | | - $from = intval( $fromstr ); |
| 209 | + $encFrom = $this->getDB()->addQuotes( intval( $continue ) ); |
221 | 210 | |
222 | | - if ( $from == 0 && strlen( $fromstr ) > 0 ) { |
223 | | - $this->dieUsage( 'Invalid continue param. You should pass the original value returned by the previous query', 'badcontinue' ); |
224 | | - } |
225 | | - |
226 | | - $encSortKey = $this->getDB()->addQuotes( $sortkey ); |
227 | | - $encFrom = $this->getDB()->addQuotes( $from ); |
228 | | - |
229 | 211 | $op = ( $dir == 'desc' ? '<' : '>' ); |
230 | 212 | |
231 | | - if ( $from != 0 ) { |
232 | | - // Duplicate sort key continue |
233 | | - $this->addWhere( "cl_sortkey$op$encSortKey OR (cl_sortkey=$encSortKey AND cl_from$op=$encFrom)" ); |
234 | | - } else { |
235 | | - $this->addWhere( "cl_sortkey$op=$encSortKey" ); |
236 | | - } |
| 213 | + $this->addWhere( "cl_from $op $encFrom" ); |
237 | 214 | } |
238 | 215 | |
239 | 216 | public function getAllowedParams() { |