User "Catrope" posted a comment on MediaWiki.r94995. Full URL: https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Special:Code/MediaWiki/94995#c21370 Commit summary:
Per CR on r44412 and my promise in the commit summary of r94990, stop abusing $wgInternalServer (intended for Squid URLs) for IRC/e-mail URLs and introduce $wgCanonicalServer for these purposes instead. This revision introduces two new hooks for WMF hacks, in exchange for making the core code saner. * Introduce $wgCanonicalServer, which should typically be a fully qualified version of $wgServer but in practice can be anything that you'd like to be used in IRC/e-mail notifs ** Default value is $wgServer, expanded to http:// if protocol-relative ** This means you can easily set HTTPS as the 'default' protocol to use in IRC and e-mail notifs by setting $wgCanonicalServer to https://example.com * Introduce Title::getCanonicalURL(). Similar to getInternalURL(), including a hook for WMF usage (which will be needed as long as secure.wikimedia.org is used) ** Also add escapeCanonicalURL(). Due to some ridiculous accident of history, the other escapeFooURL() functions don't have a $variant parameter; I decided not to follow that bad example * Reinstate the spirit of r44406 and r44412: instead of calling getInternalURL() (or getCanonicalURL()) and regexing the title parameter out, obtain the path to index.php using $wgCanonicalServer . $wgScript and append params to that. Sadly, we need to add a hook here to support the secure server hack for WMF, but that's the price of saner code in this case * Introduce the {{canonicalurl:}} and {{canonicalurle:}} parser functions, which work just like {{fullurl:}} and {{fullurle:}} except that they use getCanonicalURL() instead of getFullURL() * Use {{canonicalurl:}} in the enotif_body message, fixing bug 29993 (protocol-relative URLs appear in e-mail notifications) Comment: * Doc comments: sure, will tweak * secure.php: I know, that's why there's a big fat scaptrap on this :) * CanonicalServer: maybe I didn't document this well enough, but $wgCanonicalServer must '''always''' be the same, regardless of which protocol the user comes in on. This ensures consistency in e-mails, but also prevents cache pollution. We can choose to set it to http (which we will start out with) and we can switch it to https when we feel comfortable to, but the important thing is that it's set to a preferred protocol which is fixed. Setting wgCanonicalServer to https won't reintroduce the notification e-mail problems, it'll simply make all links in notification e-mails show https for everyone, so things don't depend on what someone else did, but on what we decide should be the site-wide default _______________________________________________ MediaWiki-CodeReview mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
