diff options
author | daniel <daniel.kinzler@wikimedia.de> | 2012-08-29 10:02:26 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2012-08-29 10:02:26 +0000 |
commit | 425ae715aaf4facf1090ba716064a591992f59bf (patch) | |
tree | a60c97e084742a28b080bec211fb38d7d417fb74 /includes/actions/RollbackAction.php | |
parent | 7b346c1db7f2b5dd666715f92e0c750abc6ef4cd (diff) | |
parent | 41842bc71b2eedc7cf665d34c227801b74637d71 (diff) | |
download | mediawikicore-425ae715aaf4facf1090ba716064a591992f59bf.tar.gz mediawikicore-425ae715aaf4facf1090ba716064a591992f59bf.zip |
Merge "Fix error display on failing rollback" into Wikidata
Diffstat (limited to 'includes/actions/RollbackAction.php')
-rw-r--r-- | includes/actions/RollbackAction.php | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/includes/actions/RollbackAction.php b/includes/actions/RollbackAction.php index 54d5e83c7f96..8d9127e57c6b 100644 --- a/includes/actions/RollbackAction.php +++ b/includes/actions/RollbackAction.php @@ -71,25 +71,18 @@ class RollbackAction extends FormlessAction { 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. - if ( !empty( $result ) && $result !== array( array( 'readonlytext' ) ) ) { - # array_diff is completely broken for arrays of arrays, sigh. - # Remove any 'readonlytext' error manually. - $out = array(); - foreach ( $result as $error ) { - if ( $error != array( 'readonlytext' ) ) { - $out [] = $error; - } - } - throw new PermissionsError( 'rollback', $out ); - } + #NOTE: Permission errors already handled by Action::checkExecute. if ( $result == array( array( 'readonlytext' ) ) ) { throw new ReadOnlyError; } + #XXX: Would be nice if ErrorPageError could take multiple errors, and/or a status object. + # Right now, we only show the first error + foreach ( $result as $error ) { + throw new ErrorPageError( 'rollbackfailed', $error[0], array_slice( $error, 1 ) ); + } + $current = $details['current']; $target = $details['target']; $newId = $details['newid']; |