Index: trunk/phase3/includes/Title.php |
— | — | @@ -837,30 +837,14 @@ |
838 | 838 | public function getFullURL( $query = '', $variant = false ) { |
839 | 839 | global $wgServer, $wgRequest; |
840 | 840 | |
841 | | - if ( is_array( $query ) ) { |
842 | | - $query = wfArrayToCGI( $query ); |
843 | | - } |
844 | | - |
845 | | - $interwiki = Interwiki::fetch( $this->mInterwiki ); |
846 | | - if ( !$interwiki ) { |
847 | | - $url = $this->getLocalURL( $query, $variant ); |
848 | | - |
849 | | - // Ugly quick hack to avoid duplicate prefixes (bug 4571 etc) |
850 | | - // Correct fix would be to move the prepending elsewhere. |
851 | | - if ( $wgRequest->getVal( 'action' ) != 'render' ) { |
852 | | - $url = $wgServer . $url; |
853 | | - } |
854 | | - } else { |
855 | | - $namespace = $this->getNsText(); |
856 | | - if ( $namespace != '' ) { |
857 | | - # Can this actually happen? Interwikis shouldn't be parsed. |
858 | | - # Yes! It can in interwiki transclusion. But... it probably shouldn't. |
859 | | - $namespace .= ':'; |
860 | | - } |
861 | | - $url = $interwiki->getURL( $namespace . $this->getDBkey() ); |
862 | | - $url = wfAppendQuery( $url, $query ); |
863 | | - } |
864 | | - |
| 841 | + # Hand off all the decisions on urls to getLocalURL |
| 842 | + $url = $this->getLocalURL( $query, $variant ); |
| 843 | + |
| 844 | + # Expand the url to make it a full url. Note that getLocalURL has the |
| 845 | + # potential to output full urls for a variety of reasons, so we use |
| 846 | + # wfExpandUrl instead of simply prepending $wgServer |
| 847 | + $url = wfExpandUrl( $url ); |
| 848 | + |
865 | 849 | # Finally, add the fragment. |
866 | 850 | $url .= $this->getFragmentForURL(); |
867 | 851 | |
— | — | @@ -887,15 +871,16 @@ |
888 | 872 | $query = wfArrayToCGI( $query ); |
889 | 873 | } |
890 | 874 | |
891 | | - if ( $this->isExternal() ) { |
892 | | - $url = $this->getFullURL(); |
893 | | - if ( $query ) { |
894 | | - // This is currently only used for edit section links in the |
895 | | - // context of interwiki transclusion. In theory we should |
896 | | - // append the query to the end of any existing query string, |
897 | | - // but interwiki transclusion is already broken in that case. |
898 | | - $url .= "?$query"; |
| 875 | + $interwiki = Interwiki::fetch( $this->mInterwiki ); |
| 876 | + if ( $interwiki ) { |
| 877 | + $namespace = $this->getNsText(); |
| 878 | + if ( $namespace != '' ) { |
| 879 | + # Can this actually happen? Interwikis shouldn't be parsed. |
| 880 | + # Yes! It can in interwiki transclusion. But... it probably shouldn't. |
| 881 | + $namespace .= ':'; |
899 | 882 | } |
| 883 | + $url = $interwiki->getURL( $namespace . $this->getDBkey() ); |
| 884 | + $url = wfAppendQuery( $url, $query ); |
900 | 885 | } else { |
901 | 886 | $dbkey = wfUrlencode( $this->getPrefixedDBkey() ); |
902 | 887 | if ( $query == '' ) { |