Show correct counts in category-info on action=info
authorumherirrender <umherirrender_de.wp@web.de>
Thu, 16 Apr 2015 18:26:27 +0000 (20:26 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Thu, 16 Apr 2015 18:26:27 +0000 (20:26 +0200)
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

includes/actions/InfoAction.php
languages/i18n/en.json
languages/i18n/qqq.json

index 4f6efd4..de4f977 100644 (file)
@@ -373,18 +373,30 @@ class InfoAction extends FormlessAction {
 
                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 )
                                )
                        );
                }
index 1dfe21d..90ee16b 100644 (file)
        "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",
index d2da2b1..d7f2ebc 100644 (file)
        "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}}",