Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
McrRestoreAction
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 5
72
0.00% covered (danger)
0.00%
0 / 1
 getName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getDescription
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 initFromParameters
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
20
 addStatePropagationFields
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 alterForm
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Temporary action for restoring multi-content revisions
4 * @file
5 * @ingroup Actions
6 */
7
8/**
9 * Temporary action for restoring multi-content revisions.
10 *
11 * This is intended to go away when real MCR support is added to EditPage and
12 * the standard revert-by-edit behavior can be implemented there instead.
13 *
14 * @ingroup Actions
15 * @since 1.32
16 */
17class 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}