Merge "CategoryTree: Use Category::getMemberCount from core"

This commit is contained in:
jenkins-bot 2022-02-22 15:38:20 +00:00 committed by Gerrit Code Review
commit 26f94361cd
2 changed files with 8 additions and 11 deletions

View file

@ -6,7 +6,7 @@
"license-name": "GPL-2.0-or-later",
"type": "parserhook",
"requires": {
"MediaWiki": ">= 1.37.0"
"MediaWiki": ">= 1.38.0"
},
"ConfigRegistry": {
"categorytree": "GlobalVarConfig::newInstance"

View file

@ -631,11 +631,11 @@ class CategoryTree {
if ( $ns === NS_CATEGORY ) {
if ( $cat ) {
if ( $mode === CategoryTreeMode::CATEGORIES ) {
$count = intval( $cat->getSubcatCount() );
$count = $cat->getSubcatCount();
} elseif ( $mode === CategoryTreeMode::PAGES ) {
$count = intval( $cat->getPageCount() ) - intval( $cat->getFileCount() );
$count = $cat->getMemberCount() - $cat->getFileCount();
} else {
$count = intval( $cat->getPageCount() );
$count = $cat->getMemberCount();
}
}
if ( $count === 0 ) {
@ -716,13 +716,10 @@ class CategoryTree {
public static function createCountString( IContextSource $context, ?Category $cat,
$countMode
) {
# Get counts, with conversion to integer so === works
# Note: $allCount is the total number of cat members,
# not the count of how many members are normal pages.
$allCount = $cat ? intval( $cat->getPageCount() ) : 0;
$subcatCount = $cat ? intval( $cat->getSubcatCount() ) : 0;
$fileCount = $cat ? intval( $cat->getFileCount() ) : 0;
$pages = $allCount - $subcatCount - $fileCount;
$allCount = $cat ? $cat->getMemberCount() : 0;
$subcatCount = $cat ? $cat->getSubcatCount() : 0;
$fileCount = $cat ? $cat->getFileCount() : 0;
$pages = $cat ? $cat->getPageCount( Category::COUNT_CONTENT_PAGES ) : 0;
$attr = [
'title' => $context->msg( 'categorytree-member-counts' )