User:Tim Starling/Weekly reports/2008-W07

From Wikipedia, the free encyclopedia
  • Packaged my X-Vary-Options squid patch. Wrote a slow upgrade script for squid, left it running all week, upgrading to the new version.
  • Assorted distractions

Message mode changes[edit]

Some MediaWiki namespace messages have a problem where the parameters $1, $2, etc. are escaped with wfEscapeWikiText() before they are sent to the message. This makes them display properly in plain text and links, but fails for {{URLENCODE:$1}}. The solution is to pass the parameter to the message without escaping it. The message itself can then apply escaping if appropriate using <nowiki>.

A second reason {{URLENCODE:$1}} can fail is because of double-parsing. Usually this is because wfMsg() is called first, which parses the message once, then parameters are substituted, and then addWikiText() is called on the output, parsing the message a second time. This causes {{URLENCODE:$1}} → %241 → %241. There was a workaround for this for the old parser, and there is a different workaround for it in the new parser, but rather than force everyone to change their workaround, we thought we would fix the root cause.

The traditional fix is to use wfMsgTrans(), but that is unwieldy and non-obvious. So I introduced two new functions: OutputPage::addWikiMsg() and OutputPage::wrapWikiMsg(), to do wikitext messages with substitution in a single call, without double-parsing.

I've converted all suitable instances of OutputPage::addWikiText() in the core to OutputPage::addWikiMsg(). The change touches a large number of files and lines of code. I still need to do more testing on it before I can commit it.