Index: branches/SerbianVariants/phase3/includes/Title.php |
— | — | @@ -821,6 +821,8 @@ |
822 | 822 | function getFullVariantURL( $variant = '' ) { |
823 | 823 | global $wgServer, $wgRequest; |
824 | 824 | |
| 825 | + $url = ''; // should not be called for interwiki |
| 826 | + |
825 | 827 | if ( '' == $this->mInterwiki ) { |
826 | 828 | $url = $this->getLocalVariantURL( $variant ); |
827 | 829 | |
— | — | @@ -829,11 +831,6 @@ |
830 | 832 | } |
831 | 833 | } |
832 | 834 | |
833 | | - # Finally, add the fragment. |
834 | | - if ( '' != $this->mFragment ) { |
835 | | - $url .= '#' . $this->mFragment; |
836 | | - } |
837 | | - |
838 | 835 | return $url; |
839 | 836 | } |
840 | 837 | |
— | — | @@ -907,10 +904,12 @@ |
908 | 905 | if($variant=='') return $this->getLocalURL(); |
909 | 906 | |
910 | 907 | if($wgVariantArticlePath==false) |
911 | | - $wgVariantArticlePath = "$wgScript?title=$1&variant=$2"; |
| 908 | + $vArticlePath = "$wgScript?title=$1&variant=$2"; // default |
| 909 | + else |
| 910 | + $vArticlePath = $wgVariantArticlePath; |
912 | 911 | |
913 | 912 | $dbkey = wfUrlencode( $this->getPrefixedDBkey() ); |
914 | | - $url = str_replace( '$1', $dbkey, $wgVariantArticlePath ); |
| 913 | + $url = str_replace( '$1', $dbkey, $vArticlePath ); |
915 | 914 | $code = urlencode( $variant ); |
916 | 915 | $url = str_replace( '$2', $code, $url ); |
917 | 916 | |
— | — | @@ -958,6 +957,23 @@ |
959 | 958 | } |
960 | 959 | |
961 | 960 | /** |
| 961 | + * Get the URL form for an internal variant link. |
| 962 | + * - Used in various Squid-related code, in case we have a different |
| 963 | + * internal hostname for the server from the exposed one. |
| 964 | + * |
| 965 | + * @param string $variant an optional query string |
| 966 | + * @return string the URL |
| 967 | + * @access public |
| 968 | + */ |
| 969 | + function getInternalVariantURL( $variant = '' ) { |
| 970 | + global $wgInternalServer; |
| 971 | + $url = $wgInternalServer . $this->getLocalVariantURL( $variant ); |
| 972 | + // not sure: wfRunHooks( 'GetInternalURL', array( &$this, &$url, $query ) ); |
| 973 | + return $url; |
| 974 | + } |
| 975 | + |
| 976 | + |
| 977 | + /** |
962 | 978 | * Get the edit URL for this Title |
963 | 979 | * @return string the URL, or a null string if this is an |
964 | 980 | * interwiki link |
— | — | @@ -1749,10 +1765,23 @@ |
1750 | 1766 | * @access public |
1751 | 1767 | */ |
1752 | 1768 | function getSquidURLs() { |
1753 | | - return array( |
| 1769 | + global $wgContLang,$wgVariantArticlePath; |
| 1770 | + |
| 1771 | + $urls = array( |
1754 | 1772 | $this->getInternalURL(), |
1755 | 1773 | $this->getInternalURL( 'action=history' ) |
1756 | 1774 | ); |
| 1775 | + |
| 1776 | + // purge variant url's as well (when using aliases) |
| 1777 | + if($wgContLang->hasVariants() && $wgVariantArticlePath!=false){ |
| 1778 | + $variants = $wgContLang->getVariants(); |
| 1779 | + foreach($variants as $vCode){ |
| 1780 | + if($vCode==$wgContLang->getCode()) continue; // we don't want default variant |
| 1781 | + $urls[] = $this->getInternalVariantURL($vCode); |
| 1782 | + } |
| 1783 | + } |
| 1784 | + |
| 1785 | + return $urls; |
1757 | 1786 | } |
1758 | 1787 | |
1759 | 1788 | function purgeSquid() { |