Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php |
— | — | @@ -427,6 +427,7 @@ |
428 | 428 | 'cl_from' ); |
429 | 429 | $where = array(); |
430 | 430 | $joins = array(); |
| 431 | + $options = array( 'ORDER BY' => 'cl_type, cl_sortkey', 'LIMIT' => $wgCategoryTreeMaxChildren ); |
431 | 432 | |
432 | 433 | if ( $inverse ) { |
433 | 434 | $joins['categorylinks'] = array( 'RIGHT JOIN', 'cl_to = page_title AND page_namespace = ' . NS_CATEGORY ); |
— | — | @@ -434,6 +435,7 @@ |
435 | 436 | } else { |
436 | 437 | $joins['categorylinks'] = array( 'JOIN', 'cl_from = page_id' ); |
437 | 438 | $where['cl_to'] = $title->getDBkey(); |
| 439 | + $options['USE INDEX']['categorylinks'] = 'cl_sortkey'; |
438 | 440 | |
439 | 441 | # namespace filter. |
440 | 442 | if ( $namespaces ) { |
— | — | @@ -457,9 +459,7 @@ |
458 | 460 | $joins['category'] = array( 'LEFT JOIN', 'cat_title = page_title AND page_namespace = ' . NS_CATEGORY ); |
459 | 461 | } |
460 | 462 | |
461 | | - $res = $dbr->select( $tables, $fields, $where, __METHOD__, |
462 | | - array( 'ORDER BY' => 'cl_type, cl_sortkey', 'LIMIT' => $wgCategoryTreeMaxChildren ), |
463 | | - $joins ); |
| 463 | + $res = $dbr->select( $tables, $fields, $where, __METHOD__, $options, $joins ); |
464 | 464 | |
465 | 465 | # collect categories separately from other pages |
466 | 466 | $categories = ''; |