Jump to content

Manual:Hooks/GetDifferenceEngine

From mediawiki.org
GetDifferenceEngine
Available from version 1.25.0 (Gerrit change 166143)
Allows custom difference engine extensions such as Extension:WikEdDiff.
Define function:
public static function onGetDifferenceEngine( $context, $old, $new, $refreshCache, $unhide, &$differenceEngine ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"GetDifferenceEngine": "MediaWiki\\Extension\\MyExtension\\Hooks::onGetDifferenceEngine"
	}
}
Called from: File(s): content/ContentHandler.php
Interface: GetDifferenceEngineHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:GetDifferenceEngine extensions/en.

Details

Called when getting a new difference engine interface object. Return false for valid object in $differenceEngine or true for the default difference engine.

  • $context: IContextSource context to be used for diff
  • $old: Revision ID to show and diff with
  • $new: Either a revision ID or one of the strings 'cur', 'prev' or 'next'
  • $refreshCache: If set, refreshes the diff cache
  • $unhide: If set, allow viewing deleted revs
  • &$differenceEngine: output parameter, difference engine object to be used for diff