Revert r36273:
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 19 Jun 2008 18:00:22 +0000 (18:00 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 19 Jun 2008 18:00:22 +0000 (18:00 +0000)
The change was described only as "Fix confused code", but it changed from something
that appears to make sense (check for a permission key for that restriction group)
to something that doesn't (hardcoded check for two particular names).

If the change has an effect, and there's a reason for it, please describe it
in a bit more detail.

includes/Article.php

index bce7202..bce69c8 100644 (file)
@@ -1835,14 +1835,11 @@ class Article {
                                }
                                $comment = $wgContLang->ucfirst( wfMsgForContent( $comment_type, $this->mTitle->getPrefixedText() ) );
 
-                               # Only restrictions with the 'protect' right can cascade...
-                               # Otherwise, people who cannot normally protect can "protect" pages via transclusion
-                               foreach( $limit as $action => $restriction ) {
-                                       # FIXME: can $restriction be an array or what? (same as fixme above)
-                                       if( $restriction != 'protect' && $restriction != 'sysop' ) {
-                                               $cascade = false;
-                                               break;
-                                       }
+                               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 = '';
@@ -1893,8 +1890,7 @@ class Article {
                                # Update the protection log
                                $log = new LogPage( 'protect' );
                                if( $protect ) {
-                                       $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle, 
-                                               trim( $reason . " [$updated]$cascade_description$expiry_description" ) );
+                                       $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle, trim( $reason . " [$updated]$cascade_description$expiry_description" ) );
                                } else {
                                        $log->addEntry( 'unprotect', $this->mTitle, $reason );
                                }