Per DKinzler's comment on Id20604d4f56e999c875b646640efb5f26c6fc912, it shows EditPage doesn't yet have full support for MCR hence, instead of phasing it out, we should leave it until full support is achieved. Change-Id: I97fca098792fb9a41640746862464f03a38aeacf
54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Temporary action for restoring multi-content revisions
|
|
* @file
|
|
* @ingroup Actions
|
|
*/
|
|
|
|
/**
|
|
* Temporary action for restoring multi-content revisions.
|
|
*
|
|
* This is intended to go away when real MCR support is added to EditPage and
|
|
* the standard revert-by-edit behavior can be implemented there instead.
|
|
*
|
|
* @ingroup Actions
|
|
* @since 1.32
|
|
*/
|
|
class McrRestoreAction extends McrUndoAction {
|
|
|
|
public function getName() {
|
|
return 'mcrrestore';
|
|
}
|
|
|
|
public function getDescription() {
|
|
return '';
|
|
}
|
|
|
|
protected function initFromParameters() {
|
|
$curRev = $this->getWikiPage()->getRevisionRecord();
|
|
if ( !$curRev ) {
|
|
throw new ErrorPageError( 'mcrundofailed', 'nopagetext' );
|
|
}
|
|
$this->curRev = $curRev;
|
|
$this->cur = $this->getRequest()->getInt( 'cur', $this->curRev->getId() );
|
|
|
|
$this->undo = $this->cur;
|
|
$this->undoafter = $this->getRequest()->getInt( 'restore' );
|
|
|
|
if ( $this->undo == 0 || $this->undoafter == 0 ) {
|
|
throw new ErrorPageError( 'mcrundofailed', 'mcrundo-missingparam' );
|
|
}
|
|
}
|
|
|
|
protected function addStatePropagationFields( HTMLForm $form ) {
|
|
$form->addHiddenField( 'restore', $this->undoafter );
|
|
$form->addHiddenField( 'cur', $this->curRev->getId() );
|
|
}
|
|
|
|
protected function alterForm( HTMLForm $form ) {
|
|
parent::alterForm( $form );
|
|
|
|
$form->setWrapperLegendMsg( 'confirm-mcrrestore-title' );
|
|
}
|
|
|
|
}
|