From c1b8d3cf08c6e252f2e9c71c83fa7336f7938e35 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 6 Dec 2008 21:16:55 +0000 Subject: [PATCH] (bug 16577) When a blocked user tries to rollback a page, the block message is now only displayed once --- RELEASE-NOTES | 2 ++ includes/Article.php | 18 ++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 23f61fc1fa..359e32f761 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -389,6 +389,8 @@ The following extensions are migrated into MediaWiki 1.14: markup now. * (bug 16529) Fix for search suggestions with some third-party JS libraries * (bug 13342) importScript() generates more consistent URI encoding +* (bug 16577) When a blocked user tries to rollback a page, the block message + is now only displayed once === API changes in 1.14 === diff --git a/includes/Article.php b/includes/Article.php index 1578e88d7c..cbed4d516f 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2493,16 +2493,18 @@ class Article { $resultDetails = null; # Check permissions - $errors = array_merge( $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser ), - $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser ) ); + $editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser ); + $rollbackErrors = $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser ); + $errors = array_merge( $editErrors, wfArrayDiff2( $rollbackErrors, $editErrors ) ); + if( !$wgUser->matchEditToken( $token, array( $this->mTitle->getPrefixedText(), $fromP ) ) ) $errors[] = array( 'sessionfailure' ); - if( $wgUser->pingLimiter('rollback') || $wgUser->pingLimiter() ) { + if( $wgUser->pingLimiter( 'rollback' ) || $wgUser->pingLimiter() ) { $errors[] = array( 'actionthrottledtext' ); } # If there were errors, bail out now - if(!empty($errors)) + if( !empty( $errors ) ) return $errors; return $this->commitRollback($fromP, $summary, $bot, $resultDetails); @@ -2637,10 +2639,6 @@ class Article { $details ); - if( in_array( array( 'blocked' ), $result ) ) { - $wgOut->blockedPage(); - return; - } if( in_array( array( 'actionthrottledtext' ), $result ) ) { $wgOut->rateLimited(); return; @@ -2662,7 +2660,7 @@ class Article { # Display permissions errors before read-only message -- there's no # point in misleading the user into thinking the inability to rollback # is only temporary. - if( !empty($result) && $result !== array( array('readonlytext') ) ) { + if( !empty( $result ) && $result !== array( array( 'readonlytext' ) ) ) { # array_diff is completely broken for arrays of arrays, sigh. Re- # move any 'readonlytext' error manually. $out = array(); @@ -2674,7 +2672,7 @@ class Article { $wgOut->showPermissionsErrorPage( $out ); return; } - if( $result == array( array('readonlytext') ) ) { + if( $result == array( array( 'readonlytext' ) ) ) { $wgOut->readOnlyPage(); return; } -- 2.20.1