Index: trunk/extensions/CategoryTree/CategoryTree.php |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | * Options: |
38 | 38 | * |
39 | 39 | * $wgCategoryTreeMaxChildren - maximum number of children shown in a tree node. Default is 200 |
| 40 | + * $wgCategoryTreeMaxScanRows - maximum number of rows the DBMS may scan while showing a tree node. |
40 | 41 | * $wgCategoryTreeAllowTag - enable <categorytree> tag. Default is true. |
41 | 42 | * $wgCategoryTreeDynamicTag - loads the first level of the tree in a <categorytag> dynamically. |
42 | 43 | * This way, the cache does not need to be disabled. Default is false. |
— | — | @@ -51,6 +52,7 @@ |
52 | 53 | */ |
53 | 54 | |
54 | 55 | $wgCategoryTreeMaxChildren = 200; |
| 56 | +$wgCategoryTreeMaxScanRows = 10000; |
55 | 57 | $wgCategoryTreeAllowTag = true; |
56 | 58 | $wgCategoryTreeDisableCache = true; |
57 | 59 | $wgCategoryTreeDynamicTag = false; |
Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php |
— | — | @@ -603,6 +603,7 @@ |
604 | 604 | * $info must be an associative array, containing at least a Title object under the 'title' key. |
605 | 605 | */ |
606 | 606 | function renderNodeInfo( $title, $cat, $children = 0, $loadchildren = false ) { |
| 607 | + global $wgCategoryTreeMaxScanRows; |
607 | 608 | static $uniq = 0; |
608 | 609 | |
609 | 610 | $mode = $this->getOption( 'mode' ); |
— | — | @@ -675,19 +676,23 @@ |
676 | 677 | |
677 | 678 | $attr = array( 'class' => 'CategoryTreeBullet' ); |
678 | 679 | |
| 680 | + # Get counts, with conversion to integer so === works |
| 681 | + $pageCount = intval( $cat->getPageCount() ); |
| 682 | + $subcatCount = intval( $cat->getSubcatCount() ); |
| 683 | + $fileCount = intval( $cat->getFileCount() ); |
| 684 | + |
679 | 685 | if ( $ns == NS_CATEGORY ) { |
| 686 | + |
680 | 687 | if ( $cat ) { |
681 | 688 | if ( $mode == CT_MODE_CATEGORIES ) { |
682 | | - $count = $cat->getSubcatCount(); |
| 689 | + $count = $subcatCount; |
683 | 690 | } else if ( $mode == CT_MODE_PAGES ) { |
684 | | - $count = $cat->getPageCount() - $cat->getFileCount(); |
| 691 | + $count = $pageCount - $fileCount; |
685 | 692 | } else { |
686 | | - $count = $cat->getPageCount(); |
| 693 | + $count = $pageCount; |
687 | 694 | } |
688 | | - # Fix conversion to string for === |
689 | | - $count = intval( $count ); |
690 | 695 | } |
691 | | - if ( $count === 0 ) { |
| 696 | + if ( $count === 0 || $pageCount > $wgCategoryTreeMaxScanRows ) { |
692 | 697 | $bullet = wfMsgNoTrans( 'categorytree-empty-bullet' ) . ' '; |
693 | 698 | $attr['class'] = 'CategoryTreeEmptyBullet'; |
694 | 699 | } else { |
— | — | @@ -721,15 +726,15 @@ |
722 | 727 | } else { |
723 | 728 | $bullet = wfMsgNoTrans( 'categorytree-page-bullet' ); |
724 | 729 | } |
725 | | - $s .= Xml::tags( 'span', $attr, $bullet ); |
| 730 | + $s .= Xml::tags( 'span', $attr, $bullet ) . ' '; |
726 | 731 | |
727 | 732 | $s .= Xml::openElement( 'a', array( 'class' => $labelClass, 'href' => $wikiLink ) ) . $label . Xml::closeElement( 'a' ); |
728 | 733 | |
729 | 734 | if ( $count !== false && $this->getOption( 'showcount' ) ) { |
730 | | - $pages = $cat->getPageCount() - $cat->getSubcatCount() - $cat->getFileCount(); |
| 735 | + $pages = $pageCount - $subcatCount - $fileCount; |
731 | 736 | |
732 | 737 | $attr = array( |
733 | | - 'title' => wfMsgExt( 'categorytree-member-counts', 'parsemag', $cat->getSubcatCount(), $pages , $cat->getFileCount(), $cat->getPageCount(), $count ) |
| 738 | + 'title' => wfMsgExt( 'categorytree-member-counts', 'parsemag', $subcatCount, $pages , $fileCount, $pageCount, $count ) |
734 | 739 | ); |
735 | 740 | |
736 | 741 | $s .= ' '; |
— | — | @@ -737,10 +742,10 @@ |
738 | 743 | $s .= Xml::tags( 'span', $attr, |
739 | 744 | wfMsgExt( 'categorytree-member-num', |
740 | 745 | array( 'parsemag', 'escapenoentities' ), |
741 | | - $cat->getSubcatCount(), |
| 746 | + $subcatCount, |
742 | 747 | $pages, |
743 | | - $cat->getFileCount(), |
744 | | - $cat->getPageCount(), |
| 748 | + $fileCount, |
| 749 | + $pageCount, |
745 | 750 | $wgLang->formatNum( $count ) ) ); |
746 | 751 | } |
747 | 752 | |