* (bug 12567) Fix for misformatted read-only messages on edit, protect.
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 15 Jan 2008 01:55:48 +0000 (01:55 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 15 Jan 2008 01:55:48 +0000 (01:55 +0000)
  Also added proper read-only checks to several special pages.
  Have removed read-only checks from the general user permission framework
  since it doesn't belong there; user authorization is independent from
  the database's read-only state, and the way we check and present error
  conditions is necessarily different. Further, as a detail it was formatting
  the actual message incorrectly as an inline message when historically it's a
  big block message with tables and images and stuff.

RELEASE-NOTES
includes/Article.php
includes/EditPage.php
includes/ProtectionForm.php
includes/SpecialImport.php
includes/SpecialUndelete.php
includes/SpecialUserrights.php
includes/Title.php

index 5a38b43..33c8392 100644 (file)
@@ -310,6 +310,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 12608) Unifying the spelling of getDBkey() in the code.
 * (bug 12611) Bot flag ignored in recent changes
 * (bug 12617) Decimal and thousands separators for Romanian
+* (bug 12567) Fix for misformatted read-only messages on edit, protect.
+  Also added proper read-only checks to several special pages.
+  Have removed read-only checks from the general user permission framework.
 
 
 == Parser changes in 1.12 ==
index 37a836e..3193d40 100644 (file)
@@ -1942,6 +1942,12 @@ class Article {
 
                # This code desperately needs to be totally rewritten
 
+               # Read-only check...
+               if ( wfReadOnly() ) {
+                       $wgOut->readOnlyPage();
+                       return;
+               }
+               
                # Check permissions
                $permission_errors = $this->mTitle->getUserPermissionsErrors( 'delete', $wgUser );
 
index ddd49e7..f3d72f5 100644 (file)
@@ -352,6 +352,12 @@ class EditPage {
                        wfProfileOut( __METHOD__ );
                        return;
                }
+               
+               if( wfReadOnly() ) {
+                       $wgOut->readOnlyPage( $this->getContent() );
+                       wfProfileOut( __METHOD__ );
+                       return;
+               }
 
                $permErrors = $this->mTitle->getUserPermissionsErrors('edit', $wgUser);
                if( !$this->mTitle->exists() ) {
index 96fc080..950a463 100644 (file)
@@ -59,7 +59,7 @@ class ProtectionForm {
                }
 
                // The form will be available in read-only to show levels.
-               $this->disabled = ($this->mPermErrors = $this->mTitle->getUserPermissionsErrors('protect',$wgUser)) != array();
+               $this->disabled = wfReadOnly() || ($this->mPermErrors = $this->mTitle->getUserPermissionsErrors('protect',$wgUser)) != array();
                $this->disabledAttrib = $this->disabled
                        ? array( 'disabled' => 'disabled' )
                        : array();
@@ -127,7 +127,13 @@ class ProtectionForm {
                # Show an appropriate message if the user isn't allowed or able to change
                # the protection settings at this time
                if( $this->disabled ) {
-                       $message = $wgOut->formatPermissionsErrorMessage( $this->mPermErrors );
+                       if( wfReadOnly() ) {
+                               $wgOut->readOnlyPage();
+                               $message = '';
+                       }
+                       if( $this->mPermErrors ) {
+                               $message = $wgOut->formatPermissionsErrorMessage( $this->mPermErrors );
+                       }
                } else {
                        $message = wfMsg( 'protect-text', wfEscapeWikiText( $this->mTitle->getPrefixedText() ) );
                }
index 9f4634b..d22e2a5 100644 (file)
@@ -34,6 +34,11 @@ function wfSpecialImport( $page = '' ) {
        $frompage = '';
        $history = true;
 
+       if ( wfReadOnly() ) {
+               $wgOut->readOnlyPage();
+               return;
+       }
+
        if( $wgRequest->wasPosted() && $wgRequest->getVal( 'action' ) == 'submit') {
                $isUpload = false;
                $namespace = $wgRequest->getIntOrNull( 'namespace' );
index a64cfc2..954d8a9 100644 (file)
@@ -1038,6 +1038,10 @@ class UndeleteForm {
 
        function undelete() {
                global $wgOut, $wgUser;
+               if ( wfReadOnly() ) {
+                       $wgOut->readOnlyPage();
+                       return;
+               }
                if( !is_null( $this->mTargetObj ) ) {
                        $archive = new PageArchive( $this->mTargetObj );
                        
index 52ece54..8cea7fd 100644 (file)
@@ -77,6 +77,12 @@ class UserrightsPage extends SpecialPage {
                        return;
                }
 
+               if ( wfReadOnly() ) {
+                       global $wgOut;
+                       $wgOut->readOnlyPage();
+                       return;
+               }
+
                $this->outputHeader();
 
                $this->setHeaders();
index 654de11..7ae2a67 100644 (file)
@@ -1038,12 +1038,6 @@ class Title {
 
                global $wgContLang;
                global $wgLang;
-
-               if ( wfReadOnly() && $action != 'read' ) {
-                       global $wgReadOnly;
-                       $errors[] = array( 'readonlytext', $wgReadOnly );
-               }
-
                global $wgEmailConfirmToEdit, $wgUser;
 
                if ( $wgEmailConfirmToEdit && !$user->isEmailConfirmed() ) {