Umherirrender has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/204557

Change subject: Show correct counts in category-info on action=info
......................................................................

Show correct counts in category-info on action=info

The number of pages was always the total count of all members of that
category, not just pages. Correct that and also show the total count.

Change-Id: I246d92b35d508e10fd93f9c7209db11a6e0eeb7a
---
M includes/actions/InfoAction.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 17 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/57/204557/1

diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php
index 4f6efd4..de4f977 100644
--- a/includes/actions/InfoAction.php
+++ b/includes/actions/InfoAction.php
@@ -373,18 +373,30 @@
 
                if ( $title->inNamespace( NS_CATEGORY ) ) {
                        $category = Category::newFromTitle( $title );
+
+                       // $allCount is the total number of cat members,
+                       // not the count of how many members are normal pages.
+                       $allCount = (int)$category->getPageCount();
+                       $subcatCount = (int)$category->getSubcatCount();
+                       $fileCount = (int)$category->getFileCount();
+                       $pagesCount = $allCount - $subcatCount - $fileCount;
+
                        $pageInfo['category-info'] = array(
                                array(
+                                       $this->msg( 'pageinfo-category-total' ),
+                                       $lang->formatNum( $allCount )
+                               ),
+                               array(
                                        $this->msg( 'pageinfo-category-pages' ),
-                                       $lang->formatNum( 
$category->getPageCount() )
+                                       $lang->formatNum( $pagesCount )
                                ),
                                array(
                                        $this->msg( 'pageinfo-category-subcats' 
),
-                                       $lang->formatNum( 
$category->getSubcatCount() )
+                                       $lang->formatNum( $subcatCount )
                                ),
                                array(
                                        $this->msg( 'pageinfo-category-files' ),
-                                       $lang->formatNum( 
$category->getFileCount() )
+                                       $lang->formatNum( $fileCount )
                                )
                        );
                }
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 1dfe21d..90ee16b 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -2583,6 +2583,7 @@
        "pageinfo-protect-cascading-yes": "Yes",
        "pageinfo-protect-cascading-from": "Protections are cascading from",
        "pageinfo-category-info": "Category information",
+       "pageinfo-category-total": "Total number of members",
        "pageinfo-category-pages": "Number of pages",
        "pageinfo-category-subcats": "Number of subcategories",
        "pageinfo-category-files": "Number of files",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index d2da2b1..d7f2ebc 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -2751,6 +2751,7 @@
        "pageinfo-protect-cascading-yes": "Yes, protections are cascading from 
here\n*{{msg-mw|Pageinfo-protect-cascading}}\n*{{msg-mw|Pageinfo-protect-cascading-yes}}\n{{Identical|Yes}}",
        "pageinfo-protect-cascading-from": "Key for a list of pages where 
protections are cascading from",
        "pageinfo-category-info": "Showed on the page displaying information 
about the current page (add \"?action=info\" to the URL)",
+       "pageinfo-category-total": "See also:\n* 
{{msg-mw|Pageinfo-category-pages}}\n* {{msg-mw|Pageinfo-category-subcats}}\n* 
{{msg-mw|Pageinfo-category-files}}",
        "pageinfo-category-pages": "See also:\n* 
{{msg-mw|Pageinfo-category-subcats}}\n* 
{{msg-mw|Pageinfo-category-files}}\n{{Identical|Number of pages}}",
        "pageinfo-category-subcats": "See also:\n* 
{{msg-mw|Pageinfo-category-pages}}\n* {{msg-mw|Pageinfo-category-files}}",
        "pageinfo-category-files": "See also:\n* 
{{msg-mw|Pageinfo-category-pages}}\n* {{msg-mw|Pageinfo-category-subcats}}",

-- 
To view, visit https://gerrit.wikimedia.org/r/204557
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I246d92b35d508e10fd93f9c7209db11a6e0eeb7a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to