From: Aaron Schulz Date: Tue, 24 Apr 2007 02:20:04 +0000 (+0000) Subject: *Actually enforce when you can cascade, add missing [cascade] comment to dummy edit... X-Git-Tag: 1.31.0-rc.0~53257 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=c8352e92485d8d38a91151b49bdf1d5bc316b5a8;p=lhc%2Fweb%2Fwiklou.git *Actually enforce when you can cascade, add missing [cascade] comment to dummy edit summary --- diff --git a/includes/Article.php b/includes/Article.php index 86f9b550da..b066ac2c0a 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1677,6 +1677,7 @@ class Article { # If nothing's changed, do nothing if( $changed ) { + global $wgGroupPermissions; if( wfRunHooks( 'ArticleProtect', array( &$this, &$wgUser, $limit, $reason ) ) ) { $dbw = wfGetDB( DB_MASTER ); @@ -1684,7 +1685,6 @@ class Article { $encodedExpiry = Block::encodeExpiry($expiry, $dbw ); $expiry_description = ''; - if ( $encodedExpiry != 'infinity' ) { $expiry_description = ' (' . wfMsgForContent( 'protect-expiring', $wgContLang->timeanddate( $expiry ) ).')'; } @@ -1692,12 +1692,25 @@ class Article { # Prepare a null revision to be added to the history $comment = $wgContLang->ucfirst( wfMsgForContent( $protect ? 'protectedarticle' : 'unprotectedarticle', $this->mTitle->getPrefixedText() ) ); + foreach( $limit as $action => $restrictions ) { + # Check if the group level required to edit also can protect pages + # Otherwise, people who cannot normally protect can "protect" pages via transclusion + $cascade = ( $cascade && isset($wgGroupPermissions[$restrictions]['protect']) && $wgGroupPermissions[$restrictions]['protect'] ); + } + + $cascade_description = ''; + if ($cascade) { + $cascade_description = ' ['.wfMsg('protect-summary-cascade').']'; + } + if( $reason ) $comment .= ": $reason"; if( $protect ) $comment .= " [$updated]"; if ( $expiry_description && $protect ) $comment .= "$expiry_description"; + if ( $cascade ) + $comment .= "$cascade_description"; $nullRevision = Revision::newNullRevision( $dbw, $id, $comment, true ); $nullRevId = $nullRevision->insertOn( $dbw ); @@ -1730,12 +1743,6 @@ class Article { # Update the protection log $log = new LogPage( 'protect' ); - $cascade_description = ''; - - if ($cascade) { - $cascade_description = ' ['.wfMsg('protect-summary-cascade').']'; - } - if( $protect ) { $log->addEntry( 'protect', $this->mTitle, trim( $reason . " [$updated]$cascade_description$expiry_description" ) ); } else {