68 if ( $from ===
null ) {
71 foreach ( [
'from',
'bot',
'hidediff',
'summary',
'token' ] as $param ) {
73 if ( $val !==
null ) {
89 if ( $this->
getUser()->getOption(
'showrollbackconfirmation' ) ==
false ||
102 $from = $request->getVal(
'from' );
104 if ( $from ===
null ) {
105 throw new ErrorPageError(
'rollbackfailed',
'rollback-missingparam' );
108 throw new ErrorPageError(
'rollbackfailed',
'rollback-missingrevision' );
111 $revUser = $rev->getUser();
112 $userText = $revUser ? $revUser->getName() :
'';
113 if ( $from !== $userText ) {
115 $this->
getTitle()->getPrefixedText(),
124 $request->getText(
'summary' ),
125 $request->getVal(
'token' ),
126 $request->getBool(
'bot' ),
131 if ( in_array( [
'actionthrottledtext' ], $errors ) ) {
136 $this->
getOutput()->setPageTitle( $this->
msg(
'rollbackfailed' ) );
137 $errArray = $errors[0];
138 $errMsg = array_shift( $errArray );
139 $this->
getOutput()->addWikiMsgArray( $errMsg, $errArray );
141 if ( isset( $data[
'current-revision-record'] ) ) {
143 $current = $data[
'current-revision-record'];
145 if ( $current->getComment() !=
null ) {
150 $current->getComment()->text
160 # NOTE: Permission errors already handled by Action::checkExecute.
161 if ( $errors == [ [
'readonlytext' ] ] ) {
165 # XXX: Would be nice if ErrorPageError could take multiple errors, and/or a status object.
166 # Right now, we only show the first error
167 foreach ( $errors as $error ) {
168 throw new ErrorPageError(
'rollbackfailed', $error[0], array_slice( $error, 1 ) );
172 $current = $data[
'current-revision-record'];
173 $target = $data[
'target-revision-record'];
174 $newId = $data[
'newid'];
175 $this->
getOutput()->setPageTitle( $this->
msg(
'actioncomplete' ) );
176 $this->
getOutput()->setRobotPolicy(
'noindex,nofollow' );
181 $currentUser = $current->getUser( RevisionRecord::FOR_THIS_USER, $user );
182 $targetUser = $target->getUser( RevisionRecord::FOR_THIS_USER, $user );
184 $this->
msg(
'rollback-success' )
185 ->rawParams( $old, $new )
186 ->params( $currentUser ? $currentUser->getName() :
'' )
187 ->params( $targetUser ? $targetUser->getName() :
'' )
191 if ( $user->getBoolOption(
'watchrollback' ) ) {
197 if ( !$request->getBool(
'hidediff',
false ) &&
198 !$this->getUser()->getBoolOption(
'norollbackdiff' )
200 $contentModel = $current->getSlot( SlotRecord::MAIN, RevisionRecord::RAW )
202 $contentHandler = MediaWikiServices::getInstance()
203 ->getContentHandlerFactory()
204 ->getContentHandler( $contentModel );
205 $de = $contentHandler->createDifferenceEngine(
212 $de->showDiff(
'',
'' );
229 $trxLimits = $this->context->getConfig()->get(
'TrxProfilerLimits' );
230 $trxProfiler = Profiler::instance()->getTransactionProfiler();
231 $trxProfiler->redefineExpectations( $trxLimits[
'POST'], $fname );
232 DeferredUpdates::addCallableUpdate(
function () use ( $trxProfiler, $trxLimits, $fname
234 $trxProfiler->redefineExpectations( $trxLimits[
'PostSend-POST'], $fname );
241 if ( $form->show() ) {
250 'vertical-label' =>
true,
252 'default' => $this->
msg(
'confirm-rollback-bottom' )->parse()
258 return isset( $errors[0][0] ) &&
259 ( $errors[0][0] ==
'alreadyrolled' ||
260 $errors[0][0] ==
'cantrollback'
wfTransactionalTimeLimit()
Set PHP's time limit to the larger of php.ini or $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 Stable to override.
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 Stable to override.
onSubmit( $data)
Process the form on POST submission.
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially Stable to override.
getRestriction()
Get the permission required to perform this action.
onSuccess()
Do something exciting on successful processing of the form.
hasRollbackRelatedErrors(array $errors)
showRollbackConfirmationForm()
doesWrites()
Stable to override.
getName()
Return the name of the action this object responds to.
Show an error when the user hits a rate limit.