Add hook for custom difference engine (WikEdDiff)
authorcacycle@gerrit.wikimedia.org <cacyclewp@gmail.com>
Fri, 10 Oct 2014 21:14:56 +0000 (23:14 +0200)
committerBryanDavis <bdavis@wikimedia.org>
Thu, 13 Nov 2014 18:02:29 +0000 (18:02 +0000)
commitef55b2c7b5e58d7f000623cfe1d4043ad59ae090
treeacec402b5a1fb35c3c58491726c054588f5af0f3
parent30d5992d5da5b35f6d351101b09fb423aa30c05c
Add hook for custom difference engine (WikEdDiff)

The new Extension:WikEdDiff is a custom inline difference engine.
There is currently no hook to integrate custom difference engines.
This patch adds a new hook called 'GetDifferenceEngine' in
/includes/content/ContentHandler.php in function
'createDifferenceEngine()'.

Passed variables:
$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

If the hook handler returns false, a valid difference engine object is
returned in the passed-by-reference variable $differenceEngine.
If the handler returns true, the default engine is used as fallback.

The specified diff engine class will typically be an extension of the
class DifferenceEngine (includes/diff/DifferenceEngine.php) with
modifications, e.g. of function generateTextDiffBody() and
__construct() (without deprecated parameter $rcid).

Also fixes a missing declaration in DifferenceEngine that is required for
extending this class.

Bug: 71916
Change-Id: I9da63c1ceb339bfeba7beddc712be51977b95f65
docs/hooks.txt
includes/content/ContentHandler.php
includes/diff/DifferenceEngine.php