52 parent::__construct(
'ComparePages' );
65 $this->
getOutput()->addModuleStyles(
'mediawiki.special' );
68 $form = HTMLForm::factory(
'ooui', [
73 'label-message' =>
'compare-page1',
81 'label-message' =>
'compare-rev1',
84 'validation-callback' => [ $this,
'checkExistingRevision' ],
90 'label-message' =>
'compare-page2',
98 'label-message' =>
'compare-rev2',
100 'section' =>
'page2',
101 'validation-callback' => [ $this,
'checkExistingRevision' ],
109 'name' =>
'diffonly',
116 $form->setSubmitTextMsg(
'compare-submit' );
117 $form->suppressReset();
118 $form->setMethod(
'get' );
119 $form->setSubmitCallback( [ $this,
'showDiff' ] );
122 $form->displayForm(
'' );
132 $rev1 = $this->
revOrTitle( $data[
'Revision1'], $data[
'Page1'] );
133 $rev2 = $this->
revOrTitle( $data[
'Revision2'], $data[
'Page2'] );
135 if ( $rev1 && $rev2 ) {
136 $revisionRecord = $this->revisionLookup->getRevisionById( $rev1 );
138 if ( $revisionRecord ) {
139 $contentModel = $revisionRecord->getSlot(
143 $contentHandler = $this->contentHandlerFactory->getContentHandler( $contentModel );
144 $de = $contentHandler->createDifferenceEngine( $form->
getContext(),
148 ( $data[
'Action'] ==
'purge' ),
149 ( $data[
'Unhide'] ==
'1' )
151 $de->showDiffPage(
true );
162 return $title->getLatestRevID();
176 if ( $value ===
'' || $value ===
null ) {
179 $revisionRecord = $this->revisionLookup->getRevisionById( $value );
180 if ( $revisionRecord ===
null ) {
181 return $this->
msg(
'compare-revision-not-exists' )->parseAsBlock();
getContext()
Get the base IContextSource object.
Implements Special:ComparePages.
IContentHandlerFactory $contentHandlerFactory
showDiff( $data, HTMLForm $form)
RevisionLookup $revisionLookup
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...
revOrTitle( $revision, $title)
__construct(RevisionLookup $revisionLookup, IContentHandlerFactory $contentHandlerFactory)
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.