MediaWiki
REL1_40
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
}
Action\getWikiPage
getWikiPage()
Get a WikiPage object.
Definition
Action.php:200
Action\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition
Action.php:141
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition
ErrorPageError.php:30
HTMLForm
Object handling generic submission, CSRF protection, layout and other logic for UI forms in a reusabl...
Definition
HTMLForm.php:153
HTMLForm\setWrapperLegendMsg
setWrapperLegendMsg( $msg)
Prompt the whole form to be wrapped in a "<fieldset>", with this message as its "<legend>" element.
Definition
HTMLForm.php:1841
HTMLForm\addHiddenField
addHiddenField( $name, $value, array $attribs=[])
Add a hidden field to the output Array values are discarded for security reasons (per WebRequest::get...
Definition
HTMLForm.php:1150
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:37
McrUndoAction\$curRev
RevisionRecord null $curRev
Definition
McrUndoAction.php:42
includes
actions
McrRestoreAction.php
Generated on Thu Jun 27 2024 14:02:10 for MediaWiki by
1.10.0