Extension talk:TransformChanges.php

From Organic Design wiki

Fix for MediaWiki 1.13

The problem is that the SpecialPageExecuteAfterPage hook doesn't get called by sub-classes of SpecialPage. In MediaWiki 1.12, the recentchanges specialpage was changed from the old-style execution method to a sub-class, and therefore prevented TransformChanges from working.

After analysing the flow of execution during the rendering of a special page I was able to find a means of hooking in to the rendered page. The webOutput method calls the builds the entire HTML output and then sends it all at once to the addHTML method of the global $wgOut object.

This means we can hook in to ChangesListInsertArticleLink (a hook which was introduced in 1.12 and is called only from a recentchanges page), and the first time it is called we can replace the $wgOut object with a replacement that runs the SpecialPageExecuteAfterPage hook if the content being outputted begins with an openening h4 tag.