User "Brion VIBBER" posted a comment on MediaWiki.r94995.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94995#c21359
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:

Looks good overall! Doc comments I think need to be tweaked to indicate $query 
can be an array, as it is on getLocalURL etc.

Deployment configuration in 
[http://noc.wikimedia.org/conf/highlight.php?file=secure.php secure.php] will 
need to be updated to continue supporting the secure.wikimedia.org gateway:
* apply the GetInternalURL hook handler to GetCanonicalURL as well (to collapse 
the expanded path back to the regular path)
* equivalent function for IRCLineURL
* set $wgCanonicalServer to the $wgInternalServer value

Note that we may not want to set $wgCanonicalServer to use 'https://', as it'll 
leave the same problems we have now with links in notification emails depending 
on what someone *else* did instead of what *you* did.

In the future though I recommend setting it '''always''' to use 'https://', for 
a magical future where we run all login sessions of SSL like sane people. :)


_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to