r5961 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r5960‎ | r5961 | r5962 >
Date:05:13, 18 October 2004
Author:wmahan
Status:old
Tags:
Comment:
brion's fix from HEAD: check that $_SERVER[] is set, to
avoid notice-level messages when running from CLI
Modified paths:
  • /branches/REL1_3/phase3/includes/DefaultSettings.php (modified) (history)
  • /branches/REL1_3/phase3/includes/Setup.php (modified) (history)

Diff [purge]

Index: branches/REL1_3/phase3/includes/DefaultSettings.php
@@ -15,14 +15,21 @@
1616 $wgMetaNamespace = FALSE; # will be same as you set $wgSitename
1717
1818
 19+if( isset( $_SERVER['SERVER_NAME'] ) ) {
 20+ $wgServerName = $_SERVER['SERVER_NAME'];
 21+} elseif( isset( $_SERVER['HOSTNAME'] ) ) {
 22+ $wgServerName = $_SERVER['HOSTNAME'];
 23+} else {
 24+ # FIXME: Fall back on... something else?
 25+ $wgServerName = 'localhost';
 26+}
 27+
1928 # check if server use https:
2029 $wgProto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2130
22 -if ( @$wgCommandLineMode ) {
23 - $wgServer = $wgProto.'://localhost';
24 -} else {
25 - $wgServer = $wgProto.'://' . $_SERVER['SERVER_NAME'];
26 - if( $_SERVER['SERVER_PORT'] != 80 ) $wgServer .= ":" . $_SERVER['SERVER_PORT'];
 31+$wgServer = $wgProto.'://' . $wgServerName;
 32+if( isset( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] != 80 ) {
 33+ $wgServer .= ":" . $_SERVER['SERVER_PORT'];
2734 }
2835 unset($wgProto);
2936
@@ -47,8 +54,8 @@
4855 $wgMathPath = "{$wgUploadPath}/math";
4956 $wgMathDirectory = "{$wgUploadDirectory}/math";
5057 $wgTmpDirectory = "{$wgUploadDirectory}/tmp";
51 -$wgEmergencyContact = 'wikiadmin@' . $_SERVER['SERVER_NAME'];
52 -$wgPasswordSender = 'Wikipedia Mail <apache@' . $_SERVER['SERVER_NAME'] . '>';
 58+$wgEmergencyContact = 'wikiadmin@' . $wgServerName;
 59+$wgPasswordSender = 'Wikipedia Mail <apache@' . $wgServerName . '>';
5360
5461 # For using a direct (authenticated) SMTP server connection.
5562 # "host" => 'SMTP domain', "IDHost" => 'domain for MessageID', "port" => "25", "auth" => true/false, "username" => user, "password" => password
Index: branches/REL1_3/phase3/includes/Setup.php
@@ -31,8 +31,11 @@
3232 array_pop($hopips);
3333 }
3434 $wgIP = trim(end($hopips));
 35+} elseif( isset( $_SERVER['REMOTE_ADDR'] ) ) {
 36+ $wgIP = $_SERVER['REMOTE_ADDR'];
3537 } else {
36 - $wgIP = $_SERVER['REMOTE_ADDR'];
 38+ # Running on CLI?
 39+ $wgIP = '127.0.0.1';
3740 }
3841
3942

Status & tagging log