(bug 40829) Show cascading protection info on action=info
authorAlex Monk <krenair@gmail.com>
Sat, 6 Oct 2012 22:32:45 +0000 (23:32 +0100)
committerAlex Monk <krenair@gmail.com>
Wed, 17 Oct 2012 22:50:08 +0000 (23:50 +0100)
Change-Id: Ibc26bf8ae4e50bb9f158f48747b648df3ecb4b49

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

index 05b6dcf..510f4ef 100644 (file)
@@ -297,6 +297,30 @@ class InfoAction extends FormlessAction {
                // Page protection
                $pageInfo['header-restrictions'] = array();
 
+               // Is this page effected by the cascading protection of something which includes it?
+               if ( $title->isCascadeProtected() ) {
+                       $cascadingFrom = '';
+                       $sources = $title->getCascadeProtectionSources(); // Array deferencing is in PHP 5.4 :(
+
+                       foreach ( $sources[0] as $sourceTitle ) {
+                               $cascadingFrom .= Html::rawElement( 'li', array(), Linker::linkKnown( $sourceTitle ) );
+                       }
+
+                       $cascadingFrom = Html::rawElement( 'ul', array(), $cascadingFrom );
+                       $pageInfo['header-restrictions'][] = array(
+                               $this->msg( 'pageinfo-protect-cascading-from' ),
+                               $cascadingFrom
+                       );
+               }
+
+               // Is out protection set to cascade to other pages?
+               if ( $title->areRestrictionsCascading() ) {
+                       $pageInfo['header-restrictions'][] = array(
+                               $this->msg( 'pageinfo-protect-cascading' ),
+                               $this->msg( 'pageinfo-protect-cascading-yes' )
+                       );
+               }
+
                // Page protection
                foreach ( $title->getRestrictionTypes() as $restrictionType ) {
                        $protectionLevel = implode( ', ', $title->getRestrictions( $restrictionType ) );
index f3ef7bf..f66e629 100644 (file)
@@ -3777,6 +3777,9 @@ This is probably caused by a link to a blacklisted external site.',
 'pageinfo-redirectsto-info'    => 'info',
 'pageinfo-contentpage'         => 'Counted as a content page',
 'pageinfo-contentpage-yes'     => 'Yes',
+'pageinfo-protect-cascading'      => 'Protections are cascading from here',
+'pageinfo-protect-cascading-yes'  => 'Yes',
+'pageinfo-protect-cascading-from' => 'Protections are cascading from',
 
 # Skin names
 'skinname-standard'    => 'Classic', # only translate this message to other languages if you have to change it
index 86b3515..777a23e 100644 (file)
@@ -3552,6 +3552,9 @@ See also {{msg-mw|Anonuser}} and {{msg-mw|Siteusers}}.',
 'pageinfo-redirectsto-info' => 'Text to put in parentheses for the link to the action=info of the redirect target.',
 'pageinfo-contentpage' => 'Key for the row shown if this page is counted as a content page',
 'pageinfo-contentpage-yes' => 'Yes, this page is a content page',
+'pageinfo-protect-cascading'      => 'Key for the row which shows whether this page has cascading protection enabled',
+'pageinfo-protect-cascading-yes'  => 'Yes, protections are cascading from here',
+'pageinfo-protect-cascading-from' => 'Key for a list of pages where protections are cascading from',
 
 # Skin names
 'skinname-standard' => '{{optional}}
index 1a9115d..60e0f30 100644 (file)
@@ -2707,6 +2707,9 @@ $wgMessageStructure = array(
                'pageinfo-redirectsto-info',
                'pageinfo-contentpage',
                'pageinfo-contentpage-yes',
+               'pageinfo-protect-cascading',
+               'pageinfo-protect-cascading-yes',
+               'pageinfo-protect-cascading-from',
        ),
        'skin' => array(
                'skinname-standard',