MediaWiki
1.42.0
McrRestoreAction.php
Go to the documentation of this file.
1
<?php
17
class
McrRestoreAction
extends
McrUndoAction
{
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
getRequest()
Action\getWikiPage
getWikiPage()
Get a WikiPage object.
Definition
Action.php:190
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition
ErrorPageError.php:30
McrRestoreAction
Temporary action for restoring multi-content revisions.
Definition
McrRestoreAction.php:17
McrRestoreAction\alterForm
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
Definition
McrRestoreAction.php:48
McrRestoreAction\getName
getName()
Return the name of the action this object responds to.
Definition
McrRestoreAction.php:19
McrRestoreAction\addStatePropagationFields
addStatePropagationFields(HTMLForm $form)
Definition
McrRestoreAction.php:43
McrRestoreAction\initFromParameters
initFromParameters()
Definition
McrRestoreAction.php:27
McrRestoreAction\getDescription
getDescription()
Returns the description that goes below the <h1> element.
Definition
McrRestoreAction.php:23
McrUndoAction
Temporary action for MCR undos.
Definition
McrUndoAction.php:43
McrUndoAction\$curRev
RevisionRecord null $curRev
Definition
McrUndoAction.php:48
includes
actions
McrRestoreAction.php
Generated on Thu Jun 13 2024 13:47:29 for MediaWiki by
1.10.0