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.
Current state
The current version (1.1.0) is successfully implementing the hack to ensure that the SpecialPageExecuteAfterPage gets called properly and gives the extension access to modify the output, but unfortunately some other HTML changes have also occurred since 1.12 and so the patterns aren't matching properly. This shouldn't be too difficult to fix however, so it should be ready soon.
1.11's HTML
1.13's HTML
|
<h4>13 January 2009</h4>
<ul class="special"><li>(<a href="/Special:Log/protect" title="Special:Log/protect">Protection log</a>); 08:32 . . <a href="/wiki/index.php?title=User:Nad&action=edit&redlink=1" class="new" title="User:Nad (not yet written)">Nad</a> (<a href="/wiki/index.php?title=User_talk:Nad&action=edit&redlink=1" class="new" title="User talk:Nad (not yet written)">Talk</a> | <a href="/Special:Contributions/Nad" title="Special:Contributions/Nad">contribs</a>) protected "<a href="/Sandbox" title="Sandbox">Sandbox</a>" <span class="comment">(see if this shows in changes for anon [edit=sysop:move=sysop:read=sysop])</span></li>
<li>(<a href="/Special:Log/rights" title="Special:Log/rights">User rights log</a>); 08:19 . . <a href="/wiki/index.php?title=User:Nad&action=edit&redlink=1" class="new" title="User:Nad (not yet written)">Nad</a> (<a href="/wiki/index.php?title=User_talk:Nad&action=edit&redlink=1" class="new" title="User talk:Nad (not yet written)">Talk</a> | <a href="/Special:Contributions/Nad" title="Special:Contributions/Nad">contribs</a>) changed group membership for <a href="/wiki/index.php?title=User:Nad&action=edit&redlink=1" class="new" title="User:Nad (not yet written)">User:Nad</a> from bot, bureaucrat, sysop to bureaucrat, sysop</li>
<li>(<a href="/wiki/index.php?title=Help:Contents&curid=11&diff=63&oldid=62" title="Help:Contents" tabindex="3">diff</a>) (<a href="/wiki/index.php?title=Help:Contents&curid=11&action=history" title="Help:Contents">hist</a>) . . <span class="bot">b</span> <a href="/Help:Contents" title="Help:Contents">Help:Contents</a>; 08:17 . . <span class='mw-plusminus-pos'>(+5)</span> . . <a href="/wiki/index.php?title=User:Nad&action=edit&redlink=1" class="new" title="User:Nad (not yet written)">Nad</a> (<a href="/wiki/index.php?title=User_talk:Nad&action=edit&redlink=1" class="new" title="User talk:Nad (not yet written)">Talk</a> | <a href="/Special:Contributions/Nad" title="Special:Contributions/Nad">contribs</a>) <span class="comment">(dsgsd)</span></li>
<li>(diff) (<a href="/wiki/index.php?title=Help:Contents&curid=11&action=history" title="Help:Contents">hist</a>) . . <span class="newpage">N</span><span class="bot">b</span> <a href="/Help:Contents" title="Help:Contents">Help:Contents</a>; 08:17 . . <span class='mw-plusminus-pos'>(+9)</span> . . <a href="/wiki/index.php?title=User:Nad&action=edit&redlink=1" class="new" title="User:Nad (not yet written)">Nad</a> (<a href="/wiki/index.php?title=User_talk:Nad&action=edit&redlink=1" class="new" title="User talk:Nad (not yet written)">Talk</a> | <a href="/Special:Contributions/Nad" title="Special:Contributions/Nad">contribs</a>) <span class="comment">(New page: sdfgsdgsd)</span></li>
<li>(diff) (<span class="unreadable">) . . <span class="newpage">N</span><span class="minor">m</span><span class="bot">b</span> <a href="/Sandbox" title="Sandbox">Sandbox</span>; 06:36 . . <span class='mw-plusminus-pos'>(+6)</span> . . <a href="/wiki/index.php?title=User:Nad&action=edit&redlink=1" class="new" title="User:Nad (not yet written)">Nad</a> (<a href="/wiki/index.php?title=User_talk:Nad&action=edit&redlink=1" class="new" title="User talk:Nad (not yet written)">Talk</a> | <a href="/Special:Contributions/Nad" title="Special:Contributions/Nad">contribs</a>) <span class="comment">(New page: dsgsdg)</span></li>
<li>(<a href="/Special:Log/delete" title="Special:Log/delete">Deletion log</a>); 06:35 . . <a href="/wiki/index.php?title=User:Nad&action=edit&redlink=1" class="new" title="User:Nad (not yet written)">Nad</a> (<a href="/wiki/index.php?title=User_talk:Nad&action=edit&redlink=1" class="new" title="User talk:Nad (not yet written)">Talk</a> | <a href="/Special:Contributions/Nad" title="Special:Contributions/Nad">contribs</a>) deleted "<span class="unreadable">" <span class="comment">(content was: '__TOC__ == Foo == aafsafas fajj fja fjasfjalfjas jfa kjf jkasf jajfajfla aafsafas fajj fja fjasfjalfjas jfa kjf jkasf jajfajfla aafsafas fajj fja fjasfjalfjas jfa kjf jka...' (and the only contributor was '<a href="/Special:Contributions/Nad" title="Special:Contributions/Nad">Nad</span>'))</span></li>
<li>(<a href="/Special:Log/rights" title="Special:Log/rights">User rights log</a>); 06:35 . . <a href="/wiki/index.php?title=User:Nad&action=edit&redlink=1" class="new" title="User:Nad (not yet written)">Nad</a> (<a href="/wiki/index.php?title=User_talk:Nad&action=edit&redlink=1" class="new" title="User talk:Nad (not yet written)">Talk</a> | <a href="/Special:Contributions/Nad" title="Special:Contributions/Nad">contribs</a>) changed group membership for <a href="/wiki/index.php?title=User:Nad&action=edit&redlink=1" class="new" title="User:Nad (not yet written)">User:Nad</a> from bureaucrat, sysop to bureaucrat, sysop, bot</li>
<li>(diff) (<a href="/wiki/index.php?title=MediaWiki:Common.css&curid=9&action=history" title="MediaWiki:Common.css">hist</a>) . . <span class="newpage">N</span> <a href="/MediaWiki:Common.css" title="MediaWiki:Common.css">MediaWiki:Common.css</a>; 06:02 . . <span class='mw-plusminus-pos'>(+590)</span> . . <a href="/wiki/index.php?title=User:Nad&action=edit&redlink=1" class="new" title="User:Nad (not yet written)">Nad</a> (<a href="/wiki/index.php?title=User_talk:Nad&action=edit&redlink=1" class="new" title="User talk:Nad (not yet written)">Talk</a> | <a href="/Special:Contributions/Nad" title="Special:Contributions/Nad">contribs</a>) <span class="comment">(New page: table.changes { border:none; width:100%; } table.changes tr { margin:0; padding:0; } table.changes td { margin:0; padding: 1px 4px 0 4px; vertical-align: top; } ...)</span></li>
</ul>
|
|