From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- includes/actions/RollbackAction.php | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'includes/actions/RollbackAction.php') diff --git a/includes/actions/RollbackAction.php b/includes/actions/RollbackAction.php index 0d9a9027..81bad9da 100644 --- a/includes/actions/RollbackAction.php +++ b/includes/actions/RollbackAction.php @@ -71,45 +71,32 @@ 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']; $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) ); $this->getOutput()->setRobotPolicy( 'noindex,nofollow' ); - if ( $current->getUserText() === '' ) { - $old = $this->msg( 'rev-deleted-user' )->escaped(); - } else { - $old = Linker::userLink( $current->getUser(), $current->getUserText() ) - . Linker::userToolLinks( $current->getUser(), $current->getUserText() ); - } - - $new = Linker::userLink( $target->getUser(), $target->getUserText() ) - . Linker::userToolLinks( $target->getUser(), $target->getUserText() ); + $old = Linker::revUserTools( $current ); + $new = Linker::revUserTools( $target ); $this->getOutput()->addHTML( $this->msg( 'rollback-success' )->rawParams( $old, $new )->parseAsBlock() ); $this->getOutput()->returnToMain( false, $this->getTitle() ); if ( !$request->getBool( 'hidediff', false ) && !$this->getUser()->getBoolOption( 'norollbackdiff', false ) ) { - $de = new DifferenceEngine( $this->getContext(), $current->getId(), $newId, false, true ); + $contentHandler = $current->getContentHandler(); + $de = $contentHandler->createDifferenceEngine( $this->getContext(), $current->getId(), $newId, false, true ); $de->showDiff( '', '' ); } } -- cgit v1.2.2