(bug 13110) Don't show "Permission error" page but "Rollback failed" if the edit...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 5 Mar 2008 13:50:17 +0000 (13:50 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 5 Mar 2008 13:50:17 +0000 (13:50 +0000)
RELEASE-NOTES
includes/Article.php

index b3dce7b..1f00e25 100644 (file)
@@ -66,6 +66,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 13019) Message cache for some extensions not loaded at time of editing
 * (bug 13247) Prettified ISBN links
 * maintenance/refreshLinks.php did not fix page_id 1 with the --new-only option
+* (bug 13110) Don't show "Permission error" page if the edit is allready rolled
+  back when using rollback
 
 === API changes in 1.13 ===
 
index 75c44cc..624c976 100644 (file)
@@ -2436,6 +2436,19 @@ class Article {
                        $wgOut->rateLimited();
                        return;
                }
+               if( isset( $result[0][0] ) && ( $result[0][0] == 'alreadyrolled' || $result[0][0] == 'cantrollback' ) ){
+                       $wgOut->setPageTitle( wfMsg( 'rollbackfailed' ) );
+                       $errArray = $result[0];
+                       $errMsg = array_shift( $errArray );
+                       $wgOut->addWikiMsgArray( $errMsg, $errArray );
+                       if( isset( $details['current'] ) ){
+                               $current = $details['current'];
+                               if( $current->getComment() != '' ) {
+                                       $wgOut->addWikiMsgArray( 'editcomment', array( $wgUser->getSkin()->formatComment( $current->getComment() ) ), array( 'replaceafter' ) );
+                               }
+                       }
+                       return;
+               }
                # Display permissions errors before read-only message -- there's no
                # point in misleading the user into thinking the inability to rollback
                # is only temporary.