mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-30 19:16:15 +00:00
Merge "CategoryTree: Use Category::getMemberCount from core"
This commit is contained in:
commit
26f94361cd
|
@ -6,7 +6,7 @@
|
||||||
"license-name": "GPL-2.0-or-later",
|
"license-name": "GPL-2.0-or-later",
|
||||||
"type": "parserhook",
|
"type": "parserhook",
|
||||||
"requires": {
|
"requires": {
|
||||||
"MediaWiki": ">= 1.37.0"
|
"MediaWiki": ">= 1.38.0"
|
||||||
},
|
},
|
||||||
"ConfigRegistry": {
|
"ConfigRegistry": {
|
||||||
"categorytree": "GlobalVarConfig::newInstance"
|
"categorytree": "GlobalVarConfig::newInstance"
|
||||||
|
|
|
@ -631,11 +631,11 @@ class CategoryTree {
|
||||||
if ( $ns === NS_CATEGORY ) {
|
if ( $ns === NS_CATEGORY ) {
|
||||||
if ( $cat ) {
|
if ( $cat ) {
|
||||||
if ( $mode === CategoryTreeMode::CATEGORIES ) {
|
if ( $mode === CategoryTreeMode::CATEGORIES ) {
|
||||||
$count = intval( $cat->getSubcatCount() );
|
$count = $cat->getSubcatCount();
|
||||||
} elseif ( $mode === CategoryTreeMode::PAGES ) {
|
} elseif ( $mode === CategoryTreeMode::PAGES ) {
|
||||||
$count = intval( $cat->getPageCount() ) - intval( $cat->getFileCount() );
|
$count = $cat->getMemberCount() - $cat->getFileCount();
|
||||||
} else {
|
} else {
|
||||||
$count = intval( $cat->getPageCount() );
|
$count = $cat->getMemberCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( $count === 0 ) {
|
if ( $count === 0 ) {
|
||||||
|
@ -716,13 +716,10 @@ class CategoryTree {
|
||||||
public static function createCountString( IContextSource $context, ?Category $cat,
|
public static function createCountString( IContextSource $context, ?Category $cat,
|
||||||
$countMode
|
$countMode
|
||||||
) {
|
) {
|
||||||
# Get counts, with conversion to integer so === works
|
$allCount = $cat ? $cat->getMemberCount() : 0;
|
||||||
# Note: $allCount is the total number of cat members,
|
$subcatCount = $cat ? $cat->getSubcatCount() : 0;
|
||||||
# not the count of how many members are normal pages.
|
$fileCount = $cat ? $cat->getFileCount() : 0;
|
||||||
$allCount = $cat ? intval( $cat->getPageCount() ) : 0;
|
$pages = $cat ? $cat->getPageCount( Category::COUNT_CONTENT_PAGES ) : 0;
|
||||||
$subcatCount = $cat ? intval( $cat->getSubcatCount() ) : 0;
|
|
||||||
$fileCount = $cat ? intval( $cat->getFileCount() ) : 0;
|
|
||||||
$pages = $allCount - $subcatCount - $fileCount;
|
|
||||||
|
|
||||||
$attr = [
|
$attr = [
|
||||||
'title' => $context->msg( 'categorytree-member-counts' )
|
'title' => $context->msg( 'categorytree-member-counts' )
|
||||||
|
|
Loading…
Reference in a new issue