Index: branches/wmf/1.17wmf1/includes/api/ApiQueryCategoryMembers.php |
— | — | @@ -144,26 +144,34 @@ |
145 | 145 | $limit = $params['limit']; |
146 | 146 | $this->addOption( 'LIMIT', $limit + 1 ); |
147 | 147 | |
148 | | - // Run a separate SELECT query for each value of cl_type. |
149 | | - // This is needed because cl_type is an enum, and MySQL has |
150 | | - // inconsistencies between ORDER BY cl_type and |
151 | | - // WHERE cl_type >= 'foo' making proper paging impossible |
152 | | - // and unindexed. |
153 | | - $rows = array(); |
154 | | - $first = true; |
155 | | - foreach ( $queryTypes as $type ) { |
156 | | - $extraConds = array( 'cl_type' => $type ); |
157 | | - if ( $first && $contWhere ) { |
158 | | - // Continuation condition. Only added to the |
159 | | - // first query, otherwise we'll skip things |
160 | | - $extraConds[] = $contWhere; |
| 148 | + if ( $params['sort'] == 'sortkey' ) { |
| 149 | + // Run a separate SELECT query for each value of cl_type. |
| 150 | + // This is needed because cl_type is an enum, and MySQL has |
| 151 | + // inconsistencies between ORDER BY cl_type and |
| 152 | + // WHERE cl_type >= 'foo' making proper paging impossible |
| 153 | + // and unindexed. |
| 154 | + $rows = array(); |
| 155 | + $first = true; |
| 156 | + foreach ( $queryTypes as $type ) { |
| 157 | + $extraConds = array( 'cl_type' => $type ); |
| 158 | + if ( $first && $contWhere ) { |
| 159 | + // Continuation condition. Only added to the |
| 160 | + // first query, otherwise we'll skip things |
| 161 | + $extraConds[] = $contWhere; |
| 162 | + } |
| 163 | + $res = $this->select( __METHOD__, array( 'where' => $extraConds ) ); |
| 164 | + $rows = array_merge( $rows, iterator_to_array( $res ) ); |
| 165 | + if ( count( $rows ) >= $limit + 1 ) { |
| 166 | + break; |
| 167 | + } |
| 168 | + $first = false; |
161 | 169 | } |
162 | | - $res = $this->select( __METHOD__, array( 'where' => $extraConds ) ); |
163 | | - $rows = array_merge( $rows, iterator_to_array( $res ) ); |
164 | | - if ( count( $rows ) >= $limit + 1 ) { |
165 | | - break; |
166 | | - } |
167 | | - $first = false; |
| 170 | + } else { |
| 171 | + // Sorting by timestamp |
| 172 | + // No need to worry about per-type queries because we |
| 173 | + // aren't sorting or filtering by type anyway |
| 174 | + $res = $this->select( __METHOD__ ); |
| 175 | + $rows = iterator_to_array( $res ); |
168 | 176 | } |
169 | 177 | $count = 0; |
170 | 178 | foreach ( $rows as $row ) { |
— | — | @@ -315,7 +323,7 @@ |
316 | 324 | ' timestamp - Adds the timestamp of when the page was included', |
317 | 325 | ), |
318 | 326 | 'namespace' => 'Only include pages in these namespaces', |
319 | | - 'type' => 'What type of category members to include', |
| 327 | + 'type' => "What type of category members to include. Ignored when {$p}sort=timestamp is set", |
320 | 328 | 'sort' => 'Property to sort by', |
321 | 329 | 'dir' => 'In which direction to sort', |
322 | 330 | 'start' => "Timestamp to start listing from. Can only be used with {$p}sort=timestamp", |
Property changes on: branches/wmf/1.17wmf1/includes/api/ApiQueryCategoryMembers.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
323 | 331 | Merged /branches/sqlite/includes/api/ApiQueryCategoryMembers.php:r58211-58321 |
324 | 332 | Merged /trunk/phase3/includes/api/ApiQueryCategoryMembers.php:r84905 |
325 | 333 | Merged /branches/wmf-deployment/includes/api/ApiQueryCategoryMembers.php:r53381,59952,60970 |
326 | 334 | Merged /branches/REL1_15/phase3/includes/api/ApiQueryCategoryMembers.php:r51646 |
327 | 335 | Merged /branches/REL1_16/phase3/includes/api/ApiQueryCategoryMembers.php:r63621-63636,69357 |
328 | 336 | Merged /branches/wmf/1.16wmf4/includes/api/ApiQueryCategoryMembers.php:r67177,69199,69521,76243,77266 |