r16829 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r16828‎ | r16829 | r16830 >
Date:04:07, 7 October 2006
Author:rainman
Status:old
Tags:
Comment:

Added variants to google sitemap.
Modified paths:
  • /branches/SerbianVariants/phase3/includes/Title.php (modified) (history)
  • /branches/SerbianVariants/phase3/maintenance/generateSitemap.php (modified) (history)

Diff [purge]

Index: branches/SerbianVariants/phase3/maintenance/generateSitemap.php
@@ -264,6 +264,16 @@
265265 $entry = $this->fileEntry( $title->getFullURL(), $date, $this->priority( $namespace ) );
266266 $length += strlen( $entry );
267267 $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+ }
268278 }
269279 if ( $this->file ) {
270280 $this->write( $this->file, $this->closeFile() );
Index: branches/SerbianVariants/phase3/includes/Title.php
@@ -812,6 +812,33 @@
813813 }
814814
815815 /**
 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+ /**
816843 * Get a URL with no fragment or server name. If this page is generated
817844 * with action=render, $wgServer is prepended.
818845 * @param string $query an optional query string; if not specified,