[FileBackend] Added work-around for lack of temp url support in rgw.
[lhc/web/wiklou.git] / includes / ProtectionForm.php
index 9643ba7..fe871b9 100644 (file)
@@ -207,6 +207,7 @@ class ProtectionForm {
                global $wgOut;
 
                $wgOut->setRobotPolicy( 'noindex,nofollow' );
+               $wgOut->addBacklinkSubtitle( $this->mTitle );
 
                if ( is_array( $err ) ) {
                        $wgOut->wrapWikiMsg( "<p class='error'>\n$1\n</p>\n", $err );
@@ -214,6 +215,18 @@ class ProtectionForm {
                        $wgOut->addHTML( "<p class='error'>{$err}</p>\n" );
                }
 
+               if ( $this->mTitle->getRestrictionTypes() === array() ) {
+                       // No restriction types available for the current title
+                       // this might happen if an extension alters the available types
+                       $wgOut->setPageTitle( wfMessage( 'protect-norestrictiontypes-title', $this->mTitle->getPrefixedText() ) );
+                       $wgOut->addWikiText( wfMessage( 'protect-norestrictiontypes-text' )->text() );
+
+                       // Show the log in case protection was possible once
+                       $this->showLogExtract( $wgOut );
+                       // return as there isn't anything else we can do
+                       return;
+               }
+
                list( $cascadeSources, /* $restrictions */ ) = $this->mTitle->getCascadeProtectionSources();
                if ( $cascadeSources && count($cascadeSources) > 0 ) {
                        $titles = '';
@@ -236,7 +249,6 @@ class ProtectionForm {
                                wfEscapeWikiText( $this->mTitle->getPrefixedText() ) );
                }
 
-               $wgOut->addBacklinkSubtitle( $this->mTitle );
                $wgOut->addHTML( $this->buildForm() );
                $this->showLogExtract( $wgOut );
        }
@@ -501,7 +513,7 @@ class ProtectionForm {
                                        <td class='mw-input'>" .
                                                Xml::checkLabel( wfMessage( 'watchthis' )->text(),
                                                        'mwProtectWatch', 'mwProtectWatch',
-                                                       $this->mTitle->userIsWatching() || $wgUser->getOption( 'watchdefault' ) ) .
+                                                       $wgUser->isWatched( $this->mTitle ) || $wgUser->getOption( 'watchdefault' ) ) .
                                        "</td>
                                </tr>";
                        }