r115399 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r115398‎ | r115399 | r115400 >
Date:10:02, 18 May 2012
Author:hashar
Status:deferred
Tags:
Comment:
support for [lang].[project].beta.wmflabs.org URLs
Modified paths:
  • /trunk/tools/mwmultiversion/multiversion/MWMultiVersion.php (modified) (history)

Diff [purge]

Index: trunk/tools/mwmultiversion/multiversion/MWMultiVersion.php
@@ -138,13 +138,18 @@
139139 # Language forced from some hacky script like extract2.php
140140 $lang = getenv( 'MW_LANG' );
141141 } elseif ( preg_match( '/^(?:\/usr\/local\/apache\/|\/home\/wikipedia\/)(?:htdocs|common\/docroot)\/([a-z]+)\.org/', $docRoot, $matches ) ) {
 142+ # This is the poor man / hacky routing engine for WMF cluster
142143 $site = $matches[1];
143144 if ( preg_match( '/^(.*)\.' . preg_quote( $site ) . '\.org$/', $serverName, $matches ) ) {
144145 $lang = $matches[1];
145146 // For some special subdomains, like pa.us
146147 $lang = str_replace( '.', '-', $lang );
147148 } else if ( preg_match( '/^(.*)\.prototype\.wikimedia\.org$/', $serverName, $matches ) ) {
 149+ // http://en.prototype.wikimedia.org/
148150 $lang = $matches[1];
 151+ } else if ( preg_match( '/^([^.]+)\.[^.]+\.beta\.wmflabs\.org$/', $serverName, $matches ) ) {
 152+ // http://en.wikipedia.beta.wmflabs.org/
 153+ $lang = $matches[1];
149154 } else {
150155 self::error( "Invalid host name ($serverName), can't determine language.\n" );
151156 }

Status & tagging log