40 parent::__construct(
'ComparePages' );
52 $this->
getOutput()->addModuleStyles(
'mediawiki.special.comparepages.styles' );
58 'label-message' =>
'compare-page1',
61 'validation-callback' => [ $this,
'checkExistingTitle' ],
66 'label-message' =>
'compare-rev1',
69 'validation-callback' => [ $this,
'checkExistingRevision' ],
74 'label-message' =>
'compare-page2',
77 'validation-callback' => [ $this,
'checkExistingTitle' ],
82 'label-message' =>
'compare-rev2',
85 'validation-callback' => [ $this,
'checkExistingRevision' ],
100 $form->setSubmitTextMsg(
'compare-submit' );
101 $form->suppressReset();
102 $form->setMethod(
'get' );
103 $form->setSubmitCallback( [ __CLASS__,
'showDiff' ] );
106 $form->displayForm(
'' );
111 $rev1 = self::revOrTitle( $data[
'Revision1'], $data[
'Page1'] );
112 $rev2 = self::revOrTitle( $data[
'Revision2'], $data[
'Page2'] );
114 if ( $rev1 && $rev2 ) {
118 $contentHandler = $revision->getContentHandler();
119 $de = $contentHandler->createDifferenceEngine( $form->
getContext(),
123 ( $data[
'Action'] ==
'purge' ),
124 ( $data[
'Unhide'] ==
'1' )
126 $de->showDiffPage(
true );
137 return $title->getLatestRevID();
150 return $this->
msg(
'compare-invalid-title' )->parseAsBlock();
152 if ( !
$title->exists() ) {
153 return $this->
msg(
'compare-title-not-exists' )->parseAsBlock();
164 if ( $revision === null ) {
165 return $this->
msg(
'compare-revision-not-exists' )->parseAsBlock();
getContext()
Gets the context this SpecialPage is executed in.
static revOrTitle($revision, $title)
Implements Special:ComparePages.
msg()
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static showDiff($data, HTMLForm $form)
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Parent class for all special pages.
execute($par)
Show a form for filtering namespace and username.
getContext()
Get the base IContextSource object.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
namespace and then decline to actually register it file or subcat img or subcat $title
static newFromId($id, $flags=0)
Load a page revision from a given revision ID number.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
checkExistingRevision($value, $alldata)
checkExistingTitle($value, $alldata)