(bug 41368) Added category information to InfoAction.
authorTyler Anthony Romeo <tylerromeo@gmail.com>
Fri, 2 Nov 2012 20:45:49 +0000 (16:45 -0400)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 6 Jan 2013 12:20:39 +0000 (12:20 +0000)
Added a Category information section to InfoAction that
only shows for NS_CATEGORY pages. It lists the number
of pages, subcategories, and files in the category.

Change-Id: Ic8965ffc7e4f9abb1f46d773839bdf5c2f06b72e

includes/actions/InfoAction.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/language/messages.inc

index f1799a4..5159a5a 100644 (file)
@@ -310,6 +310,24 @@ class InfoAction extends FormlessAction {
                        );
                }
 
+               if ( $title->inNamespace( NS_CATEGORY ) ) {
+                       $category = Category::newFromTitle( $title );
+                       $pageInfo['category-info'] = array(
+                               array(
+                                       $this->msg( 'pageinfo-category-pages' ),
+                                       $lang->formatNum( $category->getPageCount() )
+                               ),
+                               array(
+                                       $this->msg( 'pageinfo-category-subcats' ),
+                                       $lang->formatNum( $category->getSubcatCount() )
+                               ),
+                               array(
+                                       $this->msg( 'pageinfo-category-files' ),
+                                       $lang->formatNum( $category->getFileCount() )
+                               )
+                       );
+               }
+
                // Page protection
                $pageInfo['header-restrictions'] = array();
 
index e4da1dd..c774840 100644 (file)
@@ -3786,6 +3786,10 @@ This is probably caused by a link to a blacklisted external site.',
 'pageinfo-protect-cascading'      => 'Protections are cascading from here',
 'pageinfo-protect-cascading-yes'  => 'Yes',
 'pageinfo-protect-cascading-from' => 'Protections are cascading from',
+'pageinfo-category-info'       => 'Category information',
+'pageinfo-category-pages'      => 'Number of pages',
+'pageinfo-category-subcats'    => 'Number of subcategories',
+'pageinfo-category-files'      => 'Number of files',
 
 # Skin names
 'skinname-standard'    => 'Classic', # only translate this message to other languages if you have to change it
index ef31e6a..cb81824 100644 (file)
@@ -6698,6 +6698,10 @@ Used as link text, linked to '{{int:Prefixindex}}' page ([[Special:PrefixIndex]]
 *{{msg-mw|Pageinfo-protect-cascading}}
 *{{msg-mw|Pageinfo-protect-cascading-yes}}',
 'pageinfo-protect-cascading-from' => 'Key for a list of pages where protections are cascading from',
+'pageinfo-category-info' => 'Header for the category information section in InfoAction',
+'pageinfo-category-pages' => 'Label for the number of files in a category',
+'pageinfo-category-subcats' => 'Label for the number of subcategories in a category',
+'pageinfo-category-files' => 'Label for the number of files in a category',
 
 # Skin names
 'skinname-standard' => '{{optional}}
index 6544514..5e20920 100644 (file)
@@ -2720,6 +2720,10 @@ $wgMessageStructure = array(
                'pageinfo-protect-cascading',
                'pageinfo-protect-cascading-yes',
                'pageinfo-protect-cascading-from',
+               'pageinfo-category-info',
+               'pageinfo-category-pages',
+               'pageinfo-category-subcats',
+               'pageinfo-category-files'
        ),
        'skin' => array(
                'skinname-standard',