68 if ( $from ===
null ) {
71 foreach ( [
'from',
'bot',
'hidediff',
'summary',
'token' ] as $param ) {
73 if ( $val !==
null ) {
89 if ( $this->
getUser()->getOption(
'showrollbackconfirmation' ) ==
false ||
99 $this->
getOutput()->addModuleStyles(
'mediawiki.interface.helpers.styles' );
103 $from = $request->getVal(
'from' );
105 if ( $from ===
null ) {
106 throw new ErrorPageError(
'rollbackfailed',
'rollback-missingparam' );
109 throw new ErrorPageError(
'rollbackfailed',
'rollback-missingrevision' );
112 $revUser = $rev->getUser();
113 $userText = $revUser ? $revUser->getName() :
'';
114 if ( $from !== $userText ) {
116 $this->
getTitle()->getPrefixedText(),
125 $request->getText(
'summary' ),
126 $request->getVal(
'token' ),
127 $request->getBool(
'bot' ),
129 $this->getContext()->getAuthority()
132 if ( in_array( [
'actionthrottledtext' ], $errors ) ) {
137 $this->
getOutput()->setPageTitle( $this->
msg(
'rollbackfailed' ) );
138 $errArray = $errors[0];
139 $errMsg = array_shift( $errArray );
140 $this->
getOutput()->addWikiMsgArray( $errMsg, $errArray );
142 if ( isset( $data[
'current-revision-record'] ) ) {
144 $current = $data[
'current-revision-record'];
146 if ( $current->getComment() !=
null ) {
151 $current->getComment()->text
161 # NOTE: Permission errors already handled by Action::checkExecute.
162 if ( $errors == [ [
'readonlytext' ] ] ) {
166 # XXX: Would be nice if ErrorPageError could take multiple errors, and/or a status object.
167 # Right now, we only show the first error
168 foreach ( $errors as $error ) {
169 throw new ErrorPageError(
'rollbackfailed', $error[0], array_slice( $error, 1 ) );
173 $current = $data[
'current-revision-record'];
174 $target = $data[
'target-revision-record'];
175 $newId = $data[
'newid'];
176 $this->
getOutput()->setPageTitle( $this->
msg(
'actioncomplete' ) );
177 $this->
getOutput()->setRobotPolicy(
'noindex,nofollow' );
182 $currentUser = $current->getUser( RevisionRecord::FOR_THIS_USER, $user );
183 $targetUser = $target->getUser( RevisionRecord::FOR_THIS_USER, $user );
185 $this->
msg(
'rollback-success' )
186 ->rawParams( $old, $new )
187 ->params( $currentUser ? $currentUser->getName() :
'' )
188 ->params( $targetUser ? $targetUser->getName() :
'' )
192 $userOptionsLookup = MediaWikiServices::getInstance()->getUserOptionsLookup();
194 if ( $userOptionsLookup->getBoolOption( $user,
'watchrollback' ) ) {
200 if ( !$request->getBool(
'hidediff',
false ) &&
201 !$userOptionsLookup->getBoolOption( $this->getUser(),
'norollbackdiff' )
203 $contentModel = $current->getSlot( SlotRecord::MAIN, RevisionRecord::RAW )
205 $contentHandler = MediaWikiServices::getInstance()
206 ->getContentHandlerFactory()
207 ->getContentHandler( $contentModel );
208 $de = $contentHandler->createDifferenceEngine(
215 $de->showDiff(
'',
'' );
232 $trxLimits = $this->context->getConfig()->get(
'TrxProfilerLimits' );
233 $trxProfiler = Profiler::instance()->getTransactionProfiler();
234 $trxProfiler->redefineExpectations( $trxLimits[
'POST'], $fname );
235 DeferredUpdates::addCallableUpdate(
static function () use ( $trxProfiler, $trxLimits, $fname
237 $trxProfiler->redefineExpectations( $trxLimits[
'PostSend-POST'], $fname );
244 if ( $form->show() ) {
253 'vertical-label' =>
true,
255 'default' => $this->
msg(
'confirm-rollback-bottom' )->parse()
261 return isset( $errors[0][0] ) &&
262 ( $errors[0][0] ==
'alreadyrolled' ||
263 $errors[0][0] ==
'cantrollback'
wfTransactionalTimeLimit()
Raise the request time limit to $wgTransactionalTimeLimit.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
getWikiPage()
Get a WikiPage object.
checkCanExecute(User $user)
Checks if the given user (identified by an object) can perform this action.
getTitle()
Shortcut to get the Title object from the page.
getContext()
Get the IContextSource in use here.
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User being used for this instance.
setHeaders()
Set output headers for noindexing etc.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
getRequest()
Get the WebRequest being used for this instance.
An error page that emits an HTTP 400 Bad Request status code.
An error page which can definitely be safely rendered using the OutputPage.
static revUserTools( $rev, $isPublic=false, $useParentheses=true)
Generate a user tool link cluster if the current user is allowed to view it.
static formatComment( $comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
User interface for the rollback action.
getFormFields()
Get an HTMLForm descriptor array.
getDescription()
Returns the description that goes below the <h1> tag.
enableTransactionalTimelimit()
Enables transactional time limit for POST and GET requests to RollbackAction.
usesOOUI()
Whether the form should use OOUI.
onSubmit( $data)
Process the form on POST submission.
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
getRestriction()
Get the permission required to perform this action.
onSuccess()
Do something exciting on successful processing of the form.
hasRollbackRelatedErrors(array $errors)
showRollbackConfirmationForm()
getName()
Return the name of the action this object responds to.
Show an error when the user hits a rate limit.