MediaWiki REL1_33
CustomDifferenceEngine Class Reference
Inheritance diagram for CustomDifferenceEngine:
Collaboration diagram for CustomDifferenceEngine:

Public Member Functions

 __construct ()
 
 generateContentDiffBody (Content $old, Content $new)
 Generate a diff, no caching.
 
 getDiffBodyCacheKeyParams ()
 Get the cache key parameters.
 
 showDiffStyle ()
 Add style sheets for diff display.
 
- Public Member Functions inherited from DifferenceEngine
 __construct ( $context=null, $old=0, $new=0, $rcid=0, $refreshCache=false, $unhide=false)
 #-
 
 addHeader ( $diff, $otitle, $ntitle, $multi='', $notice='')
 Add the header to a diff body.
 
 deletedIdMarker ( $id)
 Build a wikitext link toward a deleted revision, if viewable.
 
 deletedLink ( $id)
 Look up a special:Undelete link to the given deleted revision id, as a workaround for being unable to load deleted diffs in currently.
 
 generateTextDiffBody ( $otext, $ntext)
 Generate a diff, no caching.
 
 getDiff ( $otitle, $ntitle, $notice='')
 Get complete diff table, including header.
 
 getDiffBody ()
 Get the diff table body, without header.
 
 getDiffBodyForRole ( $role)
 Get the diff table body for one slot, without header.
 
 getDiffLang ()
 Get the language of the difference engine, defaults to page content language.
 
 getExtraCacheKeys ()
 Implements DifferenceEngineSlotDiffRenderer::getExtraCacheKeys().
 
 getMultiNotice ()
 If there are revisions between the ones being compared, return a note saying so.
 
 getNewid ()
 Get the ID of new revision (right pane) of the diff.
 
 getNewRevision ()
 Get the right side of the diff.
 
 getOldid ()
 Get the ID of old revision (left pane) of the diff.
 
 getOldRevision ()
 Get the left side of the diff.
 
 getRevisionHeader (Revision $rev, $complete='')
 Get a header for a specified revision.
 
 getTitle ()
 
 loadNewText ()
 Load the text of the new revision, not the old one.
 
 loadRevisionData ()
 Load revision metadata for the specified revisions.
 
 loadText ()
 Load the text of the revisions, as well as revision data.
 
 localiseLineNumbers ( $text)
 Replace line numbers with the text in the user's language.
 
 localiseLineNumbersCb ( $matches)
 
 mapDiffPrevNext ( $old, $new)
 Maps a revision pair definition as accepted by DifferenceEngine constructor to a pair of actual integers representing revision ids.
 
 markAsSlotDiffRenderer ()
 Mark this DifferenceEngine as a slot renderer (as opposed to a page renderer).
 
 markPatrolledLink ()
 Build a link to mark a change as patrolled.
 
 renderNewRevision ()
 Show the new revision of the page.
 
 setContent (Content $oldContent, Content $newContent)
 Use specified text instead of loading from the database.
 
 setReducedLineNumbers ( $value=true)
 Set reduced line numbers mode.
 
 setRevisions (RevisionRecord $oldRevision=null, RevisionRecord $newRevision)
 Use specified text instead of loading from the database.
 
 setTextLanguage (Language $lang)
 Set the language in which the diff text is written.
 
 showDiff ( $otitle, $ntitle, $notice='')
 Get the diff text, send it to the OutputPage object Returns false if the diff could not be generated, otherwise returns true.
 
 showDiffPage ( $diffOnly=false)
 
 wasCacheHit ()
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage().
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID.
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object.
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getStats ()
 
 getTiming ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ( $key)
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 

Additional Inherited Members

- Static Public Member Functions inherited from DifferenceEngine
static getEngine ()
 Process $wgExternalDiffEngine and get a sane, usable engine.
 
static intermediateEditsMsg ( $numEdits, $numUsers, $limit)
 Get a notice about how many intermediate edits and users there are.
 
- Public Attributes inherited from DifferenceEngine
 $enableDebugComment = false
 Set this to true to add debug info to the HTML output.
 
const DIFF_VERSION = '1.12'
 Constant to indicate diff cache compatibility.
 
- Protected Member Functions inherited from DifferenceEngine
 debug ( $generator="internal")
 Generate a debug comment indicating diff generating time, server node, and generator backend.
 
 getDiffBodyCacheKey ()
 Returns the cache key for diff body text or content.
 
 getMarkPatrolledLinkInfo ()
 Returns an array of meta data needed to build a "mark as patrolled" link and adds the mediawiki.page.patrol.ajax to the output.
 
 getParserOutput (WikiPage $page, Revision $rev)
 
 getSlotContents ()
 Get the old and new content objects for all slots.
 
 getSlotDiffRenderers ()
 
 getSlotHeader ( $headerText)
 Get a slot header for inclusion in a diff body (as a table row).
 
 revisionDeleteLink ( $rev)
 
 textDiff ( $otext, $ntext)
 Generates diff, to be wrapped internally in a logging/instrumentation.
 
- Protected Attributes inherited from DifferenceEngine
bool $isContentOverridden = false
 Was the content overridden via setContent()? If the content was overridden, most internal state (e.g.
 
bool $isSlotDiffRenderer = false
 Temporary hack for B/C while slot diff related methods of DifferenceEngine are being deprecated.
 
bool $mCacheHit = false
 Was the diff fetched from cache?
 
Language $mDiffLang
 
string $mMarkPatrolledLink = null
 Link to action=markpatrolled.
 
int string false null $mNewid
 Revision ID for the new revision.
 
Title null $mNewPage
 Title of $mNewRev or null if the new revision does not exist or does not belong to a page.
 
Revision null $mNewRev
 New revision (right pane).
 
int false null $mOldid
 Revision ID for the old revision.
 
Title null $mOldPage
 Title of $mOldRev or null if the old revision does not exist or does not belong to a page.
 
Revision null false $mOldRev
 Old revision (left pane).
 
bool $mReducedLineNumbers = false
 If true, line X is not displayed when X is 1, for example to increase readability and conserve space with many small diffs.
 
bool $mRefreshCache = false
 Refresh the diff cache.
 
bool $mRevisionsLoaded = false
 Have the revisions been loaded.
 
int $mTextLoaded = 0
 How many text blobs have been loaded, 0, 1 or 2?
 
SlotDiffRenderer[] $slotDiffRenderers = null
 DifferenceEngine classes for the slots, keyed by role name.
 
bool $unhide = false
 Show rev_deleted content if allowed.
 

Detailed Description

Definition at line 3 of file CustomDifferenceEngine.php.

Constructor & Destructor Documentation

◆ __construct()

CustomDifferenceEngine::__construct ( )

Definition at line 5 of file CustomDifferenceEngine.php.

Member Function Documentation

◆ generateContentDiffBody()

CustomDifferenceEngine::generateContentDiffBody ( Content $old,
Content $new )

Generate a diff, no caching.

Since
1.21
Parameters
Content$oldOld content
Content$newNew content
Exceptions
ExceptionIf old or new content is not an instance of TextContent.
Returns
bool|string
Deprecated
since 1.32, use a SlotDiffRenderer instead.

Reimplemented from DifferenceEngine.

Definition at line 9 of file CustomDifferenceEngine.php.

◆ getDiffBodyCacheKeyParams()

CustomDifferenceEngine::getDiffBodyCacheKeyParams ( )

Get the cache key parameters.

Subclasses can replace the first element in the array to something more specific to the type of diff (e.g. "inline-diff"), or append if the cache should vary on more things. Overriding entirely should be avoided.

Since
1.31
Returns
array
Exceptions
MWException

Reimplemented from DifferenceEngine.

Definition at line 17 of file CustomDifferenceEngine.php.

References $params.

◆ showDiffStyle()

CustomDifferenceEngine::showDiffStyle ( )

Add style sheets for diff display.

Reimplemented from DifferenceEngine.

Definition at line 13 of file CustomDifferenceEngine.php.

References ContextSource\getOutput().


The documentation for this class was generated from the following file: