Index: trunk/tools/mwmultiversion/wmf-config/CommonSettings.php |
— | — | @@ -79,15 +79,19 @@ |
80 | 80 | wfProfileOut( "$fname-init" ); |
81 | 81 | wfProfileIn( "$fname-host" ); |
82 | 82 | |
| 83 | +# wmf-config directory (in common/) |
| 84 | +$wmfConfigDir = "$IP/../wmf-config"; |
| 85 | + |
83 | 86 | # Determine domain and language and the directories for this instance |
84 | | -require_once( $IP . '/../wmf-config/MWMultiVersion.php' ); |
| 87 | +require_once( "$wmfConfigDir/MWMultiVersion.php" ); |
85 | 88 | if ( (@$_SERVER['SCRIPT_NAME']) == '/w/thumb.php' && (@$_SERVER['SERVER_NAME']) == 'upload.wikimedia.org' ) { |
86 | 89 | $multiVersion = MWMultiVersion::getInstanceForUploadWiki( $_SERVER['PATH_INFO'] ); |
87 | | -} else if ( $wgCommandLineMode) { |
| 90 | +} else if ( $wgCommandLineMode ) { |
88 | 91 | $multiVersion = MWMultiVersion::getInstanceForMaintenance(); |
89 | 92 | } else { |
90 | 93 | $multiVersion = MWMultiVersion::getInstanceForWiki( $_SERVER['SERVER_NAME'], $_SERVER['DOCUMENT_ROOT'] ); |
91 | 94 | } |
| 95 | + |
92 | 96 | $site = $multiVersion->getSite(); |
93 | 97 | $lang = $multiVersion->getLang(); |
94 | 98 | $wgDBname = $multiVersion->getDatabase(); |
— | — | @@ -95,9 +99,6 @@ |
96 | 100 | |
97 | 101 | wfProfileOut( "$fname-host" ); |
98 | 102 | |
99 | | -# wmf-config directory |
100 | | -$wmfConfigDir = "$IP/../wmf-config"; |
101 | | - |
102 | 103 | # Initialise wgConf |
103 | 104 | wfProfileIn( "$fname-wgConf" ); |
104 | 105 | require( "$wmfConfigDir/wgConf.php" ); |
Index: trunk/tools/mwmultiversion/wmf-config/MWMultiVersion.php |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | $secure = getenv( 'MW_SECURE_HOST' ); |
69 | 69 | $matches = array(); |
70 | 70 | if ( $secure ) { |
71 | | - if ( !preg_match('/^([^.]+).([^.]+).*$/', $secure, $matches ) ) { |
| 71 | + if ( !preg_match('/^([^.]+)\.([^.]+)\./', $secure, $matches ) ) { |
72 | 72 | die("invalid hostname"); |
73 | 73 | } |
74 | 74 | $this->lang = $matches[1]; |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | $this->site = $pathBits[1]; |
110 | 110 | $this->lang = $pathBits[2]; |
111 | 111 | } |
112 | | - |
| 112 | + |
113 | 113 | /** |
114 | 114 | * Gets the site and lang from env variables |
115 | 115 | */ |