diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/actions/RollbackAction.php | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/includes/actions/RollbackAction.php b/includes/actions/RollbackAction.php index 9719b15ae6fc..4467c7a6b56c 100644 --- a/includes/actions/RollbackAction.php +++ b/includes/actions/RollbackAction.php @@ -20,7 +20,9 @@ * @ingroup Actions */ +use MediaWiki\MediaWikiServices; use MediaWiki\Revision\RevisionRecord; +use MediaWiki\Revision\SlotRecord; /** * User interface for the rollback action @@ -133,14 +135,16 @@ class RollbackAction extends FormAction { $this->getOutput()->addWikiMsgArray( $errMsg, $errArray ); if ( isset( $data['current'] ) ) { - /** @var Revision $current */ - $current = $data['current']; + /** @var RevisionRecord $current */ + $current = $data['current']->getRevisionRecord(); - if ( $current->getComment() != '' ) { + if ( $current->getComment() != null ) { $this->getOutput()->addWikiMsg( 'editcomment', Message::rawParam( - Linker::formatComment( $current->getComment() ) + Linker::formatComment( + $current->getComment()->text + ) ) ); } @@ -160,20 +164,23 @@ class RollbackAction extends FormAction { throw new ErrorPageError( 'rollbackfailed', $error[0], array_slice( $error, 1 ) ); } - /** @var Revision $current */ - $current = $data['current']; - $target = $data['target']; + /** @var RevisionRecord $current */ + $current = $data['current']->getRevisionRecord(); + $target = $data['target']->getRevisionRecord(); $newId = $data['newid']; $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) ); $this->getOutput()->setRobotPolicy( 'noindex,nofollow' ); - $old = Linker::revUserTools( $current->getRevisionRecord() ); - $new = Linker::revUserTools( $target->getRevisionRecord() ); + $old = Linker::revUserTools( $current ); + $new = Linker::revUserTools( $target ); + + $currentUser = $current->getUser( RevisionRecord::FOR_THIS_USER, $user ); + $targetUser = $target->getUser( RevisionRecord::FOR_THIS_USER, $user ); $this->getOutput()->addHTML( $this->msg( 'rollback-success' ) ->rawParams( $old, $new ) - ->params( $current->getUserText( RevisionRecord::FOR_THIS_USER, $user ) ) - ->params( $target->getUserText( RevisionRecord::FOR_THIS_USER, $user ) ) + ->params( $currentUser ? $currentUser->getName() : '' ) + ->params( $targetUser ? $targetUser->getName() : '' ) ->parseAsBlock() ); @@ -186,7 +193,11 @@ class RollbackAction extends FormAction { if ( !$request->getBool( 'hidediff', false ) && !$this->getUser()->getBoolOption( 'norollbackdiff' ) ) { - $contentHandler = $current->getContentHandler(); + $contentModel = $current->getSlot( SlotRecord::MAIN, RevisionRecord::RAW ) + ->getModel(); + $contentHandler = MediaWikiServices::getInstance() + ->getContentHandlerFactory() + ->getContentHandler( $contentModel ); $de = $contentHandler->createDifferenceEngine( $this->getContext(), $current->getId(), |