Page MenuHomePhabricator

DoubleWiki assumes the OutputPageBeforeHTML hook is only executed once per page view
Open, LowPublic

Description

In T323376, @matmarex wrote:

As documented on Manual:Hooks/OutputPageBeforeHTML, the OutputPageBeforeHTML hook can be executed more than once per page view, if the page content is composed from multiple sources.

For example, if the MediaWiki:Talkpageheader localisation message is defined, it is inserted at the top of all talk pages, and the hook is called twice: for the content from this message and for the content from the page's wikitext. This can be reproduced on e.g. https://fr.m.wikipedia.org/wiki/Discussion:Rhinocéros_de_Louis_XV.

  1. Since DoubleWiki works with interlanguage links, I had to get MediaWiki display interlanguage links in talk namespaces. I could’ve probably written an extension that adds them (or install Wikibase), but the easiest solution was simply modifying Parser.php to remove the $nottalk check from the code recognizing interlanguage links. Isn’t likely to happen in production, but it fits for testing. 🙂
  2. Created MediaWiki:talkpageheader, calling a template in which I “forgot” to wrap the interlanguage link in <noinclude>.
  3. Also added a direct interlanguage link to a talk page.
  4. Opened the talk page with &match=hu added to the URL.
  5. Got QuadrupleWiki instead of DoubleWiki: both the talk page header and the main content got their Hungarian equivalents – except that sometimes the main content also got the Hungarian equivalent of the talk page header, probably due to cache pollution.

Until someone comes up with a such way to reproduce this that at least doesn’t involve modifying the parser, it’s pretty low-priority, but it’s still a bug.