r16878 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r16877‎ | r16878 | r16879 >
Date:00:28, 9 October 2006
Author:brion
Status:old
Tags:
Comment:
Revert r16860
Appears to be placing variant URLs into the main article space,
creating URL ambiguity and probably cache problems.
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/languages/LanguageConverter.php (modified) (history)
  • /trunk/phase3/maintenance/generateSitemap.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/generateSitemap.php
@@ -264,16 +264,6 @@
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 - foreach($variants as $vCode){
272 - if($vCode==$wgContLang->getCode()) continue; // we don't want default variant
273 - $entry = $this->fileEntry( $title->getFullVariantURL($vCode), $date, $this->priority( $namespace ) );
274 - $length += strlen( $entry );
275 - $this->write( $this->file, $entry );
276 - }
277 - }
278268 }
279269 if ( $this->file ) {
280270 $this->write( $this->file, $this->closeFile() );
Index: trunk/phase3/includes/Title.php
@@ -812,35 +812,6 @@
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 - $url=''; // this function should not be called for interwiki
826 -
827 - if ( '' == $this->mInterwiki ) {
828 - $url = $this->getLocalVariantURL( $variant );
829 -
830 - if ($wgRequest->getVal('action') != 'render') {
831 - $url = $wgServer . $url;
832 - }
833 - }
834 -
835 - # Finally, add the fragment.
836 - if ( '' != $this->mFragment ) {
837 - $url .= '#' . $this->mFragment;
838 - }
839 -
840 - return $url;
841 - }
842 -
843 -
844 - /**
845816 * Get a URL with no fragment or server name. If this page is generated
846817 * with action=render, $wgServer is prepended.
847818 * @param string $query an optional query string; if not specified,
@@ -897,30 +868,6 @@
898869 }
899870
900871 /**
901 - * Similar to getLocalURL, except it uses $wgVariantArticlePath
902 - * and gets the URL with no fragment or server name, but in a
903 - * certain language variant (relevant only to languages with variants)
904 - * @param string $variant caption of variant
905 - * @return string the URL
906 - * @access public
907 - */
908 - function getLocalVariantURL( $variant='' ) {
909 - global $wgVariantArticlePath,$wgScript;
910 - if($variant=='') return $this->getLocalURL();
911 -
912 - if($wgVariantArticlePath==false)
913 - $wgVariantArticlePath = "$wgScript?title=$1&variant=$2";
914 -
915 - $dbkey = wfUrlencode( $this->getPrefixedDBkey() );
916 - $url = str_replace( '$1', $dbkey, $wgVariantArticlePath );
917 - $code = urlencode( $variant );
918 - $url = str_replace( '$2', $code, $url );
919 -
920 - return $url;
921 -
922 - }
923 -
924 - /**
925872 * Get an HTML-escaped version of the URL form, suitable for
926873 * using in a link, without a server name or fragment
927874 * @param string $query an optional query string
Index: trunk/phase3/includes/SkinTemplate.php
@@ -765,7 +765,7 @@
766766 $content_actions['varlang-' . $vcount] = array(
767767 'class' => $selected,
768768 'text' => $varname,
769 - 'href' => $this->mTitle->getLocalVariantURL($code)
 769+ 'href' => $this->mTitle->getLocalUrl( $actstr . 'variant=' . urlencode( $code ) )
770770 );
771771 $vcount ++;
772772 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -124,7 +124,6 @@
125125 $wgStyleDirectory = "{$IP}/skins";
126126 $wgStyleSheetPath = &$wgStylePath;
127127 $wgArticlePath = "{$wgScript}?title=$1";
128 -$wgVariantArticlePath = false;
129128 $wgUploadPath = "{$wgScriptPath}/images";
130129 $wgUploadDirectory = "{$IP}/images";
131130 $wgHashedUploadDirectory = true;
Index: trunk/phase3/languages/LanguageConverter.php
@@ -96,14 +96,6 @@
9797 return $req;
9898 }
9999
100 - // check the syntax /code/ArticleTitle
101 - $script = $_SERVER['SCRIPT_NAME'];
102 - $variants = implode('|',$this->mVariants);
103 - if(preg_match("/($variants)$/",$script,$matches)){
104 - $this->mPreferredVariant = $matches[1];
105 - return $this->mPreferredVariant;
106 - }
107 -
108100 // get language variant preference from logged in users
109101 // Don't call this on stub objects because that causes infinite
110102 // recursion during initialisation

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r16860Merged r16826-16858 of branches/SerbianVariants....rainman13:37, 8 October 2006