r92309 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92308‎ | r92309 | r92310 >
Date:21:36, 15 July 2011
Author:aaron
Status:ok
Tags:
Comment:
* Made use of $wmfConfigDir in one place
* Minor regexp fixes
Modified paths:
  • /trunk/tools/mwmultiversion/wmf-config/CommonSettings.php (modified) (history)
  • /trunk/tools/mwmultiversion/wmf-config/MWMultiVersion.php (modified) (history)

Diff [purge]

Index: trunk/tools/mwmultiversion/wmf-config/CommonSettings.php
@@ -79,15 +79,19 @@
8080 wfProfileOut( "$fname-init" );
8181 wfProfileIn( "$fname-host" );
8282
 83+# wmf-config directory (in common/)
 84+$wmfConfigDir = "$IP/../wmf-config";
 85+
8386 # Determine domain and language and the directories for this instance
84 -require_once( $IP . '/../wmf-config/MWMultiVersion.php' );
 87+require_once( "$wmfConfigDir/MWMultiVersion.php" );
8588 if ( (@$_SERVER['SCRIPT_NAME']) == '/w/thumb.php' && (@$_SERVER['SERVER_NAME']) == 'upload.wikimedia.org' ) {
8689 $multiVersion = MWMultiVersion::getInstanceForUploadWiki( $_SERVER['PATH_INFO'] );
87 -} else if ( $wgCommandLineMode) {
 90+} else if ( $wgCommandLineMode ) {
8891 $multiVersion = MWMultiVersion::getInstanceForMaintenance();
8992 } else {
9093 $multiVersion = MWMultiVersion::getInstanceForWiki( $_SERVER['SERVER_NAME'], $_SERVER['DOCUMENT_ROOT'] );
9194 }
 95+
9296 $site = $multiVersion->getSite();
9397 $lang = $multiVersion->getLang();
9498 $wgDBname = $multiVersion->getDatabase();
@@ -95,9 +99,6 @@
96100
97101 wfProfileOut( "$fname-host" );
98102
99 -# wmf-config directory
100 -$wmfConfigDir = "$IP/../wmf-config";
101 -
102103 # Initialise wgConf
103104 wfProfileIn( "$fname-wgConf" );
104105 require( "$wmfConfigDir/wgConf.php" );
Index: trunk/tools/mwmultiversion/wmf-config/MWMultiVersion.php
@@ -67,7 +67,7 @@
6868 $secure = getenv( 'MW_SECURE_HOST' );
6969 $matches = array();
7070 if ( $secure ) {
71 - if ( !preg_match('/^([^.]+).([^.]+).*$/', $secure, $matches ) ) {
 71+ if ( !preg_match('/^([^.]+)\.([^.]+)\./', $secure, $matches ) ) {
7272 die("invalid hostname");
7373 }
7474 $this->lang = $matches[1];
@@ -108,7 +108,7 @@
109109 $this->site = $pathBits[1];
110110 $this->lang = $pathBits[2];
111111 }
112 -
 112+
113113 /**
114114 * Gets the site and lang from env variables
115115 */

Status & tagging log