- if ( is_array( $query ) ) {
- $query = wfArrayToCGI( $query );
- }
-
- $interwiki = Interwiki::fetch( $this->mInterwiki );
- if ( !$interwiki ) {
- $url = $this->getLocalURL( $query, $variant );
-
- // Ugly quick hack to avoid duplicate prefixes (bug 4571 etc)
- // Correct fix would be to move the prepending elsewhere.
- if ( $wgRequest->getVal( 'action' ) != 'render' ) {
- $url = $wgServer . $url;
- }
- } else {
- $namespace = $this->getNsText();
- if ( $namespace != '' ) {
- # Can this actually happen? Interwikis shouldn't be parsed.
- # Yes! It can in interwiki transclusion. But... it probably shouldn't.
- $namespace .= ':';
- }
- $url = $interwiki->getURL( $namespace . $this->getDBkey() );
- $url = wfAppendQuery( $url, $query );
- }
-
+ # Hand off all the decisions on urls to getLocalURL
+ $url = $this->getLocalURL( $query, $variant );
+
+ # Expand the url to make it a full url. Note that getLocalURL has the
+ # potential to output full urls for a variety of reasons, so we use
+ # wfExpandUrl instead of simply prepending $wgServer
+ $url = wfExpandUrl( $url );
+