Adding a bunch of hooks from wikiHow into DifferenceEngine, 2nd try
authorJack Phoenix <jack@countervandalism.net>
Fri, 8 Jul 2016 16:46:20 +0000 (19:46 +0300)
committerJack Phoenix <jack@countervandalism.net>
Fri, 8 Jul 2016 16:46:20 +0000 (19:46 +0300)
commit03dfe2c3be0f904061bf9bbd30122bfe599fd38f
tree6327a2cc6caa9a7c80311b2a31d0846c6f8495c7
parent507a6aece2707816375468589b7a7992c9ad9380
Adding a bunch of hooks from wikiHow into DifferenceEngine, 2nd try

Now with less fatals and more functionality! At least I sure hope so.

Unlike the first time around (https://gerrit.wikimedia.org/r/206642), the
DifferenceEngineRenderRevisionAddParserOutput and
DifferenceEngineShowEmptyOldContent hooks now only affect things if a
hooked function returns false. Since by default nothing is hooked into
these brand new hooks, the behavior should stay exactly the same as before
this patch and things like bug T139435 shouldn't happen anymore.

These hooks allow things such as:
* adding CSS(/JS) into the OutputPage when viewing diffs
* adding extra HTML content (such as avatars) into diff views
* hiding the bottom "mark as patrolled" link
* altering the parser output that is used by DifferenceEngine
* and more

Example extension using these hooks is wikiHow's
/extensions/wikihow/hooks/, specifically the file DiffHooks.php (but the
hooks are setup in WikihowHooks.php).

Live example of the DiffHooks stuff in action can be found at wikiHow.com,
for example:
http://www.wikihow.com/index.php?title=Set-Your-Homepage&diff=17112892&oldid=15888129
(user avatars, additional CSS, changes to the old/new revision header
texts/links)

Bug: T139526
Change-Id: I10293be4581140c3edf0e4b538b04b31cb6f5730
docs/hooks.txt
includes/diff/DifferenceEngine.php