diff --git a/extension.json b/extension.json index f0a095bc..5752fabe 100644 --- a/extension.json +++ b/extension.json @@ -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" diff --git a/includes/CategoryTree.php b/includes/CategoryTree.php index 0608cb5a..c70ac2d5 100644 --- a/includes/CategoryTree.php +++ b/includes/CategoryTree.php @@ -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' )