*/
class McrUndoAction extends FormAction {
- private $undo = 0, $undoafter = 0, $cur = 0;
+ protected $undo = 0, $undoafter = 0, $cur = 0;
/** @param RevisionRecord|null */
- private $curRev = null;
+ protected $curRev = null;
public function getName() {
return 'mcrundo';
parent::show();
}
- protected function checkCanExecute( User $user ) {
- parent::checkCanExecute( $user );
-
+ protected function initFromParameters() {
$this->undoafter = $this->getRequest()->getInt( 'undoafter' );
$this->undo = $this->getRequest()->getInt( 'undo' );
}
$this->curRev = $curRev->getRevisionRecord();
$this->cur = $this->getRequest()->getInt( 'cur', $this->curRev->getId() );
+ }
+
+ protected function checkCanExecute( User $user ) {
+ parent::checkCanExecute( $user );
+
+ $this->initFromParameters();
$revisionLookup = MediaWikiServices::getInstance()->getRevisionLookup();
'attribs' => Linker::tooltipAndAccesskeyAttribs( 'diff' ),
] );
+ $this->addStatePropagationFields( $form );
+ }
+
+ protected function addStatePropagationFields( HTMLForm $form ) {
$form->addHiddenField( 'undo', $this->undo );
$form->addHiddenField( 'undoafter', $this->undoafter );
$form->addHiddenField( 'cur', $this->curRev->getId() );