r80639 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80638‎ | r80639 | r80640 >
Date:19:37, 20 January 2011
Author:catrope
Status:ok
Tags:
Comment:
Clean up query generation in CategoryTree a little bit
Modified paths:
  • /trunk/extensions/CategoryTree/CategoryTreeFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php
@@ -430,7 +430,7 @@
431431 $options = array( 'ORDER BY' => 'cl_type, cl_sortkey', 'LIMIT' => $wgCategoryTreeMaxChildren );
432432
433433 if ( $inverse ) {
434 - $joins['categorylinks'] = array( 'RIGHT JOIN', 'cl_to = page_title AND page_namespace = ' . NS_CATEGORY );
 434+ $joins['categorylinks'] = array( 'RIGHT JOIN', array( 'cl_to = page_title', 'page_namespace' => NS_CATEGORY ) );
435435 $where['cl_from'] = $title->getArticleId();
436436 } else {
437437 $joins['categorylinks'] = array( 'JOIN', 'cl_from = page_id' );
@@ -456,7 +456,7 @@
457457 if ( $doCount ) {
458458 $tables = array_merge( $tables, array( 'category' ) );
459459 $fields = array_merge( $fields, array( 'cat_id', 'cat_title', 'cat_subcats', 'cat_pages', 'cat_files' ) );
460 - $joins['category'] = array( 'LEFT JOIN', 'cat_title = page_title AND page_namespace = ' . NS_CATEGORY );
 460+ $joins['category'] = array( 'LEFT JOIN', array( 'cat_title = page_title', 'page_namespace' => NS_CATEGORY ) );
461461 }
462462
463463 $res = $dbr->select( $tables, $fields, $where, __METHOD__, $options, $joins );

Status & tagging log