r89577 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89576‎ | r89577 | r89578 >
Date:16:13, 6 June 2011
Author:pdhanda
Status:deferred
Tags:
Comment:
Current version of MW wrapper in /home/wikipedia/common/live-1.5. This is where changes for multiple versions will be checked in
Modified paths:
  • /trunk/tools/mwmultiversion (added) (history)
  • /trunk/tools/mwmultiversion/MWVersion.php (added) (history)

Diff [purge]

Index: trunk/tools/mwmultiversion/MWVersion.php
@@ -0,0 +1,68 @@
 2+<?php
 3+
 4+function host2db( $host ) {
 5+ if( $host == 'wikimediafoundation.org' || $host == 'www.wikimediafoundation.org' )
 6+ return 'foundationwiki';
 7+ if ( $host == 'wikisource.org' || $host == 'www.wikisource.org' )
 8+ return 'sourceswiki';
 9+ if ( $host == 'mediawiki.org' || $host == 'www.mediawiki.org' )
 10+ return 'mediawikiwiki';
 11+ if( preg_match( '/^(.*)\.(.*)\.org$/', $host, $matches ) ) {
 12+ list( $whole, $lang, $site ) = $matches;
 13+ $lang = str_replace( '-', '_', $lang );
 14+ switch( $site ) {
 15+ case 'wikipedia':
 16+ case 'wikimedia':
 17+ return $lang . 'wiki';
 18+ default:
 19+ return $lang . $site;
 20+ }
 21+ }
 22+ return null;
 23+}
 24+
 25+function wfIsConverted( $host ) {
 26+ return true;
 27+
 28+ /*
 29+ $db = host2db( $host );
 30+
 31+ #$all = array_map( 'trim', file( '/usr/local/apache/common/all.dblist' ) );
 32+ #$started = array_map( 'trim', file( '/home/wikipedia/logs/conversion15start' ) );
 33+
 34+ $converted = array_map( 'trim', file( '/usr/local/apache/common/1.17.dblist' ) );
 35+ #$converted = array( 'test2wiki' );
 36+ return in_array( $db, $converted );
 37+ */
 38+}
 39+
 40+function getMediaWiki( $file ) {
 41+ $secure = getenv( 'MW_SECURE_HOST' );
 42+ $host = $secure ? $secure : $_SERVER['HTTP_HOST'];
 43+ $new = wfIsConverted( $host );
 44+ $version = $new ? 'php-1.17' : 'wmf-deployment';
 45+ if ( $new ) {
 46+ define( 'ONE_SEVENTEEN', 1 );
 47+ }
 48+
 49+ if ( $host == 'test.wikipedia.org' && !$secure &&
 50+ !preg_match( '!thumb\.php!', $_SERVER['REQUEST_URI'] ) ) {
 51+ define( 'TESTWIKI', 1 );
 52+ // As horrible hack for NFS-less iamge scalers, use regular docroot for thumbs?
 53+# $IP = '/home/wikipedia/common/php-1.5';
 54+ $IP = "/home/wikipedia/common/$version";
 55+ } else {
 56+ $IP = "/usr/local/apache/common/$version";
 57+ }
 58+ #} elseif( $host == 'www.mediawiki.org' || $host == 'meta.wikimedia.org' ) {
 59+ # $IP = '/usr/local/apache/common/wmf-deployment';
 60+ #} else {
 61+ # $IP = '/usr/local/apache/common/php-1.5';
 62+ #}
 63+
 64+ chdir( $IP );
 65+ putenv( "MW_INSTALL_PATH=$IP" );
 66+ return "$IP/$file";
 67+}
 68+
 69+?>

Follow-up revisions

RevisionCommit summaryAuthorDate
r89578Fix svn props for r89577reedy16:19, 6 June 2011

Status & tagging log