Index: branches/SerbianVariants/phase3/maintenance/generateSitemap.php |
— | — | @@ -264,6 +264,16 @@ |
265 | 265 | $entry = $this->fileEntry( $title->getFullURL(), $date, $this->priority( $namespace ) ); |
266 | 266 | $length += strlen( $entry ); |
267 | 267 | $this->write( $this->file, $entry ); |
| 268 | + // generate pages for language variants |
| 269 | + if($wgContLang->hasVariants()){ |
| 270 | + $variants = $wgContLang->getVariants(); |
| 271 | + unset($variants[array_search($wgContLang->getCode(),$variants)]); // we don't want default |
| 272 | + foreach($variants as $vCode){ |
| 273 | + $entry = $this->fileEntry( $title->getFullVariantURL($vCode), $date, $this->priority( $namespace ) ); |
| 274 | + $length += strlen( $entry ); |
| 275 | + $this->write( $this->file, $entry ); |
| 276 | + } |
| 277 | + } |
268 | 278 | } |
269 | 279 | if ( $this->file ) { |
270 | 280 | $this->write( $this->file, $this->closeFile() ); |
Index: branches/SerbianVariants/phase3/includes/Title.php |
— | — | @@ -812,6 +812,33 @@ |
813 | 813 | } |
814 | 814 | |
815 | 815 | /** |
| 816 | + * Get a real URL referring to this title in some of the variant |
| 817 | + * |
| 818 | + * @param string $variant variant name |
| 819 | + * @return string the URL |
| 820 | + * @access public |
| 821 | + */ |
| 822 | + function getFullVariantURL( $variant = '' ) { |
| 823 | + global $wgServer, $wgRequest; |
| 824 | + |
| 825 | + if ( '' == $this->mInterwiki ) { |
| 826 | + $url = $this->getLocalVariantURL( $variant ); |
| 827 | + |
| 828 | + if ($wgRequest->getVal('action') != 'render') { |
| 829 | + $url = $wgServer . $url; |
| 830 | + } |
| 831 | + } |
| 832 | + |
| 833 | + # Finally, add the fragment. |
| 834 | + if ( '' != $this->mFragment ) { |
| 835 | + $url .= '#' . $this->mFragment; |
| 836 | + } |
| 837 | + |
| 838 | + return $url; |
| 839 | + } |
| 840 | + |
| 841 | + |
| 842 | + /** |
816 | 843 | * Get a URL with no fragment or server name. If this page is generated |
817 | 844 | * with action=render, $wgServer is prepended. |
818 | 845 | * @param string $query an optional query string; if not specified, |