*Cascading protection notice, show regular protection and cascading notices if both...
authorAaron Schulz <aaron@users.mediawiki.org>
Sat, 21 Apr 2007 19:02:02 +0000 (19:02 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sat, 21 Apr 2007 19:02:02 +0000 (19:02 +0000)
includes/EditPage.php

index b0695ea..5eea10c 100644 (file)
@@ -995,20 +995,22 @@ class EditPage {
                                if( wfEmptyMsg( 'semiprotectedpagewarning', $notice ) || $notice == '-' )
                                        $notice = '';
                        } else {
-                               # It's either cascading protection or regular protection; work out which
-                               list($cascadeSources, $restrictions) = $this->mTitle->getCascadeProtectionSources();
-                               if ( !$cascadeSources || count( $cascadeSources ) == 0 ) {
-                                       # Regular protection
-                                       $notice = wfMsg( 'protectedpagewarning' );
-                               } else {
-                                       # Cascading protection; explain, and list the titles responsible
-                                       $notice = wfMsg( 'cascadeprotectedwarning' ) . "\n";
-                                       foreach( $cascadeSources as $source )
-                                               $notice .= '* [[:' . $source->getPrefixedText() . "]]\n";
-                               }
+                       # Then it must be protected based on static groups (regular)
+                               $notice = wfMsg( 'protectedpagewarning' );
                        }
                        $wgOut->addWikiText( $notice );
                }
+               if ( $this->mTitle->isCascadeProtected() ) {
+                       # Is this page under cascading protection from some source pages?
+                       list($cascadeSources, $restrictions) = $this->mTitle->getCascadeProtectionSources();
+                       if ( count($cascadeSources) > 0 ) {
+                               # Explain, and list the titles responsible
+                               $notice = wfMsg( 'cascadeprotectedwarning' ) . "\n";
+                               foreach( $cascadeSources as $id => $page )
+                                       $notice .= '* [[:' . $page->getPrefixedText() . "]]\n";
+                               }
+                       $wgOut->addWikiText( $notice );
+               }
 
                if ( $this->kblength === false ) {
                        $this->kblength = (int)(strlen( $this->textbox1 ) / 1024);