44 parent::__construct(
'ComparePages' );
55 $this->
getOutput()->addModuleStyles(
'mediawiki.special' );
58 $form = HTMLForm::factory(
'ooui', [
62 'label-message' =>
'compare-page1',
65 'validation-callback' => [ $this,
'checkExistingTitle' ],
71 'label-message' =>
'compare-rev1',
74 'validation-callback' => [ $this,
'checkExistingRevision' ],
79 'label-message' =>
'compare-page2',
82 'validation-callback' => [ $this,
'checkExistingTitle' ],
88 'label-message' =>
'compare-rev2',
91 'validation-callback' => [ $this,
'checkExistingRevision' ],
106 $form->setSubmitTextMsg(
'compare-submit' );
107 $form->suppressReset();
108 $form->setMethod(
'get' );
109 $form->setSubmitCallback( [ __CLASS__,
'showDiff' ] );
112 $form->displayForm(
'' );
120 if ( $rev1 && $rev2 ) {
121 $revisionRecord = MediaWikiServices::getInstance()
122 ->getRevisionLookup()
123 ->getRevisionById( $rev1 );
125 if ( $revisionRecord ) {
126 $contentModel = $revisionRecord->getSlot(
130 $contentHandler = MediaWikiServices::getInstance()
131 ->getContentHandlerFactory()
132 ->getContentHandler( $contentModel );
133 $de = $contentHandler->createDifferenceEngine( $form->
getContext(),
137 ( $data[
'Action'] ==
'purge' ),
138 ( $data[
'Unhide'] ==
'1' )
140 $de->showDiffPage(
true );
151 return $title->getLatestRevID();
159 if ( $value ===
'' || $value ===
null ) {
162 $title = Title::newFromText( $value );
164 return $this->
msg(
'compare-invalid-title' )->parseAsBlock();
166 if ( !
$title->exists() ) {
167 return $this->
msg(
'compare-title-not-exists' )->parseAsBlock();
174 if ( $value ===
'' || $value ===
null ) {
177 $revisionRecord = MediaWikiServices::getInstance()
178 ->getRevisionLookup()
179 ->getRevisionById( $value );
180 if ( $revisionRecord ===
null ) {
181 return $this->
msg(
'compare-revision-not-exists' )->parseAsBlock();
getContext()
Get the base IContextSource object.
Implements Special:ComparePages.
static revOrTitle( $revision, $title)
checkExistingTitle( $value, $alldata)
static showDiff( $data, HTMLForm $form)
execute( $par)
Show a form for filtering namespace and username.
checkExistingRevision( $value, $alldata)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!...
getOutput()
Get the OutputPage being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Represents a title within MediaWiki.