From 80823c253992da9bd802265ad51d559b7000de80 Mon Sep 17 00:00:00 2001 From: Kevin Israel Date: Fri, 5 Jul 2013 17:28:37 -0400 Subject: [PATCH] Unbreak cascading protection Title::getRestrictions can return "sysop", which will not match if replaced out of $cascadingRestrictionLevels but not $editrestriction, making it impossible to cascade protect a page with the default value of $wgCascadingRestrictionLevels. Follows-up I6bf650a3fbdab8589ae6945c8c916eafd949e41c. Change-Id: Ie7183ed9509ea9c65a7197fc9cead6c8423b852e --- includes/WikiPage.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 4aab67474c..910aeaef61 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2346,6 +2346,12 @@ class WikiPage implements Page, IDBAccessObject { // Only certain restrictions can cascade... Otherwise, users who cannot normally protect pages // could "protect" them by transcluding them on protected pages they are allowed to edit. $editrestriction = isset( $limit['edit'] ) ? array( $limit['edit'] ) : $this->mTitle->getRestrictions( 'edit' ); + foreach ( array_keys( $editrestriction, 'sysop' ) as $key ) { + $editrestriction[$key] = 'editprotected'; // backwards compatibility + } + foreach ( array_keys( $editrestriction, 'autoconfirmed' ) as $key ) { + $editrestriction[$key] = 'editsemiprotected'; // backwards compatibility + } $cascadingRestrictionLevels = $wgCascadingRestrictionLevels; foreach ( array_keys( $cascadingRestrictionLevels, 'sysop' ) as $key ) { -- 2.20.1