Page MenuHomePhabricator

Hook into the article read path via `ShowMissingArticle`
Open, MediumPublic

Description

Hook into the article read path via ShowMissingArticle as the recommended entry point, which gives us the "local article wins" collision policy for free. ShowMissingArticle fires only when MediaWiki has already determined that no local article exists at the requested title, so using it means: if a local article exists, the hook simply does not fire and the normal read path serves the local article unchanged; there is no separate "does the local article exist?" check to maintain, no risk of scattered special cases, no ParserCache subtlety to reason about, and no sidebar comparison, partial render, or fallback-after-render-failure code path where locally-authored content could accidentally be displaced.

MediaWiki's own article lookup runs before the hook and carries all of that correctness for us. This is the simplest possible enforcement of the rule committed to in the M2 header — "the local article always wins, unconditionally and without any sysop action" — and the simplicity is exactly the reason it can be defended to any community reviewer as "we never displace locally-authored content". The implementer should use ShowMissingArticle unless it turns out not to expose the context needed to render and short-circuit the response (for example, if the hook signature does not allow suppressing the default missing-article output, or if a different hook is needed to populate skin chrome correctly); in that case, picking an alternative hook is acceptable, but the alternative must still preserve the "local article wins" property by construction rather than by an added explicit check.