Followup r94754: move protocol expansion from getIRCLine() to inside getInternalUrl...
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 08:56:39 +0000 (08:56 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 08:56:39 +0000 (08:56 +0000)
We should really, really break the connection between internal URLs used for Squid purges and URLs used for IRC, and use the latter in e-mails as well. This was briefly discussed in the CR comments on r44412 and I'll be working on that today.

includes/RecentChange.php
includes/Title.php

index a3deb91..b01368c 100644 (file)
@@ -707,9 +707,7 @@ class RecentChange {
                        // XXX: *HACK^2* the preg_replace() undoes much of what getInternalURL() does, but we 
                        // XXX: need to call it so that URL paths on the Wikimedia secure server can be fixed
                        // XXX: by a custom GetInternalURL hook --vyznev 2008-12-10
-                       // XXX: Also, getInternalUrl() may return a protocol-relative URL.
-                       // XXX: In that case, expand it to an HTTP URL, even if this is an HTTPS request --catrope 2011-08-17
-                       $url = preg_replace( '/title=[^&]*&/', '', wfExpandUrl( $titleObj->getInternalURL( $url ), PROTO_HTTP ) );
+                       $url = preg_replace( '/title=[^&]*&/', '', $titleObj->getInternalURL( $url ) );
                }
 
                if( isset( $this->mExtra['oldSize'] ) && isset( $this->mExtra['newSize'] ) ) {
index 29f292e..fab3b5b 100644 (file)
@@ -992,6 +992,10 @@ class Title {
         * Get the URL form for an internal link.
         * - Used in various Squid-related code, in case we have a different
         * internal hostname for the server from the exposed one.
+        * 
+        * This uses $wgInternalServer to qualify the path, or $wgServer
+        * if $wgInternalServer is not set. If the server variable used is
+        * protocol-relative, the URL will be expanded to http://
         *
         * @param $query String an optional query string
         * @param $variant String language variant of url (for sr, zh..)
@@ -1000,7 +1004,7 @@ class Title {
        public function getInternalURL( $query = '', $variant = false ) {
                global $wgInternalServer, $wgServer;
                $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer;
-               $url = $server . $this->getLocalURL( $query, $variant );
+               $url = wfExpandUrl( $server . $this->getLocalURL( $query, $variant ), PROTO_HTTP );
                wfRunHooks( 'GetInternalURL', array( &$this, &$url, $query ) );
                return $url;
        }