*/
use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\MutableRevisionRecord;
-use MediaWiki\Storage\RevisionRecord;
-use MediaWiki\Storage\SlotRecord;
+use MediaWiki\Revision\MutableRevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
+use MediaWiki\Revision\SlotRecord;
/**
* Temporary action for MCR undos
*/
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();
$previewHTML = '';
}
- $previewhead = "<div class='previewnote'>\n" .
- '<h2 id="mw-previewheader">' . $this->context->msg( 'preview' )->escaped() . "</h2>" .
- $out->parse( $note, true, /* interface */true ) . "<hr /></div>\n";
+ $previewhead = Html::rawElement(
+ 'div', [ 'class' => 'previewnote' ],
+ Html::element(
+ 'h2', [ 'id' => 'mw-previewheader' ],
+ $this->context->msg( 'preview' )->text()
+ ) .
+ $out->parseAsInterface( $note ) .
+ "<hr />"
+ );
$pageViewLang = $this->getTitle()->getPageViewLanguage();
$attribs = [ 'lang' => $pageViewLang->getHtmlCode(), 'dir' => $pageViewLang->getDir(),
protected function getFormFields() {
$request = $this->getRequest();
- $config = $this->context->getConfig();
- $oldCommentSchema = $config->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
$ret = [
'diff' => [
'type' => 'info',
'name' => 'wpSummary',
'cssclass' => 'mw-summary',
'label-message' => 'summary',
- 'maxlength' => $oldCommentSchema ? 200 : CommentStore::COMMENT_CHARACTER_LIMIT,
+ 'maxlength' => CommentStore::COMMENT_CHARACTER_LIMIT,
'value' => $request->getVal( 'wpSummary', '' ),
'size' => 60,
'spellcheck' => 'true',
'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() );