Manual:Hooks/GetDifferenceEngine

From Linux Web Expert

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

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:GetDifferenceEngine extensions</tvar>.</translate>

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