From: Alex Monk Date: Sat, 6 Oct 2012 22:32:45 +0000 (+0100) Subject: (bug 40829) Show cascading protection info on action=info X-Git-Tag: 1.31.0-rc.0~21975 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=a079411cdee554e0124b74fd64141a94d8ca8d7e;p=lhc%2Fweb%2Fwiklou.git (bug 40829) Show cascading protection info on action=info Change-Id: Ibc26bf8ae4e50bb9f158f48747b648df3ecb4b49 --- diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 05b6dcfc71..510f4ef48c 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -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 ) ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index f3ef7bfdeb..f66e6297c1 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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 diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index 86b3515682..777a23e9d3 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -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}} diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 1a9115dfc9..60e0f30e59 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -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',