MediaWiki 1.42.0
McrRestoreAction.php
Go to the documentation of this file.
1<?php
18
19 public function getName() {
20 return 'mcrrestore';
21 }
22
23 public function getDescription() {
24 return '';
25 }
26
27 protected function initFromParameters() {
28 $curRev = $this->getWikiPage()->getRevisionRecord();
29 if ( !$curRev ) {
30 throw new ErrorPageError( 'mcrundofailed', 'nopagetext' );
31 }
32 $this->curRev = $curRev;
33 $this->cur = $this->getRequest()->getInt( 'cur', $this->curRev->getId() );
34
35 $this->undo = $this->cur;
36 $this->undoafter = $this->getRequest()->getInt( 'restore' );
37
38 if ( $this->undo == 0 || $this->undoafter == 0 ) {
39 throw new ErrorPageError( 'mcrundofailed', 'mcrundo-missingparam' );
40 }
41 }
42
43 protected function addStatePropagationFields( HTMLForm $form ) {
44 $form->addHiddenField( 'restore', $this->undoafter );
45 $form->addHiddenField( 'cur', $this->curRev->getId() );
46 }
47
48 protected function alterForm( HTMLForm $form ) {
49 parent::alterForm( $form );
50
51 $form->setWrapperLegendMsg( 'confirm-mcrrestore-title' );
52 }
53
54}
getRequest()
getWikiPage()
Get a WikiPage object.
Definition Action.php:190
An error page which can definitely be safely rendered using the OutputPage.
Temporary action for restoring multi-content revisions.
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
getName()
Return the name of the action this object responds to.
addStatePropagationFields(HTMLForm $form)
getDescription()
Returns the description that goes below the <h1> element.
Temporary action for MCR undos.
RevisionRecord null $curRev