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

Additional Inherited Members

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

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: