Go to the documentation of this file.
66 if ( $from ===
null ) {
69 foreach ( [
'from',
'bot',
'hidediff',
'summary',
'token' ] as $param ) {
71 if ( $val !==
null ) {
83 if ( $this->
getUser()->getOption(
'showrollbackconfirmation' ) ==
false ||
96 $from = $request->getVal(
'from' );
97 $rev = $this->page->getRevision();
98 if ( $from ===
null ) {
99 throw new ErrorPageError(
'rollbackfailed',
'rollback-missingparam' );
102 throw new ErrorPageError(
'rollbackfailed',
'rollback-missingrevision' );
104 if ( $from !== $rev->getUserText() ) {
106 $this->
getTitle()->getPrefixedText(),
113 $errors = $this->page->doRollback(
115 $request->getText(
'summary' ),
116 $request->getVal(
'token' ),
117 $request->getBool(
'bot' ),
122 if ( in_array( [
'actionthrottledtext' ], $errors ) ) {
127 $this->
getOutput()->setPageTitle( $this->
msg(
'rollbackfailed' ) );
128 $errArray = $errors[0];
129 $errMsg = array_shift( $errArray );
130 $this->
getOutput()->addWikiMsgArray( $errMsg, $errArray );
132 if ( isset( $data[
'current'] ) ) {
134 $current = $data[
'current'];
136 if ( $current->getComment() !=
'' ) {
149 # NOTE: Permission errors already handled by Action::checkExecute.
150 if ( $errors == [ [
'readonlytext' ] ] ) {
154 # XXX: Would be nice if ErrorPageError could take multiple errors, and/or a status object.
155 # Right now, we only show the first error
156 foreach ( $errors as $error ) {
157 throw new ErrorPageError(
'rollbackfailed', $error[0], array_slice( $error, 1 ) );
161 $current = $data[
'current'];
162 $target = $data[
'target'];
163 $newId = $data[
'newid'];
164 $this->
getOutput()->setPageTitle( $this->
msg(
'actioncomplete' ) );
165 $this->
getOutput()->setRobotPolicy(
'noindex,nofollow' );
170 $this->
msg(
'rollback-success' )
171 ->rawParams( $old, $new )
172 ->params( $current->getUserText( RevisionRecord::FOR_THIS_USER, $user ) )
173 ->params( $target->getUserText( RevisionRecord::FOR_THIS_USER, $user ) )
177 if ( $user->getBoolOption(
'watchrollback' ) ) {
183 if ( !$request->getBool(
'hidediff',
false ) &&
184 !$this->
getUser()->getBoolOption(
'norollbackdiff' )
186 $contentHandler = $current->getContentHandler();
187 $de = $contentHandler->createDifferenceEngine(
194 $de->showDiff(
'',
'' );
211 $trxLimits = $this->context->getConfig()->get(
'TrxProfilerLimits' );
213 $trxProfiler->redefineExpectations( $trxLimits[
'POST'], $fname );
216 $trxProfiler->redefineExpectations( $trxLimits[
'PostSend-POST'], $fname );
223 if ( $form->show() ) {
232 'vertical-label' =>
true,
234 'default' => $this->
msg(
'confirm-rollback-bottom' )->parse()
240 return isset( $errors[0][0] ) &&
241 ( $errors[0][0] ==
'alreadyrolled' ||
242 $errors[0][0] ==
'cantrollback'
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
showRollbackConfirmationForm()
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
static instance()
Singleton.
getRequest()
Get the WebRequest being used for this instance.
getDescription()
Returns the description that goes below the <h1> tag.
getFormFields()
Get an HTMLForm descriptor array.
usesOOUI()
Whether the form should use OOUI.
getContext()
Get the IContextSource in use here.
wfTransactionalTimeLimit()
Set PHP's time limit to the larger of php.ini or $wgTransactionalTimeLimit.
onSubmit( $data)
Process the form on POST submission.
Show an error when the user hits a rate limit.
enableTransactionalTimelimit()
Enables transactional time limit for POST and GET requests to RollbackAction.
static revUserTools( $rev, $isPublic=false, $useParentheses=true)
Generate a user tool link cluster if the current user is allowed to view it.
getUser()
Shortcut to get the User being used for this instance.
hasRollbackRelatedErrors(array $errors)
getRestriction()
Get the permission required to perform this action.
getTitle()
Shortcut to get the Title object from the page.
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...
User interface for the rollback action.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
An error page that emits an HTTP 400 Bad Request status code.
getOutput()
Get the OutputPage being used for this instance.
doesWrites()
Indicates whether this action may perform database writes.
onSuccess()
Do something exciting on successful processing of the form.
An error page which can definitely be safely rendered using the OutputPage.
static addCallableUpdate( $callable, $stage=self::POSTSEND, $dbw=null)
Add a callable update.
getName()
Return the name of the action this object responds to.