# setting up a few globals.
#
-global $wgProfiling, $wgProfileSampleRate, $wgIP, $wgUseSquid, $IP;
+global $wgProfiling, $wgProfileSampleRate, $wgIP, $IP;
if( !isset( $wgProfiling ) )
$wgProfiling = false;
function wfProfileClose() {}
}
-
-
-/* collect the originating ips */
-if( $wgUseSquid && isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
- # If the web server is behind a reverse proxy, we need to find
- # out where our requests are really coming from.
- $hopips = array_map( 'trim', explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ) );
-
- $allsquids = array_merge($wgSquidServers, $wgSquidServersNoPurge);
- while(in_array(trim(end($hopips)), $allsquids)){
- array_pop($hopips);
- }
- $wgIP = trim(end($hopips));
-} elseif( isset( $_SERVER['REMOTE_ADDR'] ) ) {
- $wgIP = $_SERVER['REMOTE_ADDR'];
-} else {
- # Running on CLI?
- $wgIP = '127.0.0.1';
-}
-
$fname = 'Setup.php';
wfProfileIn( $fname );
global $wgUseDynamicDates;
require_once( 'WebRequest.php' );
require_once( 'LoadBalancer.php' );
require_once( 'HistoryBlob.php' );
-
-$wgRequest = new WebRequest();
+require_once( 'ProxyTools.php' );
wfProfileOut( $fname.'-includes' );
wfProfileIn( $fname.'-misc1' );
global $wgFullyInitialised;
+$wgIP = wfGetIP();
+$wgRequest = new WebRequest();
+
# Useful debug output
if ( $wgCommandLineMode ) {
# wfDebug( '"' . implode( '" "', $argv ) . '"' );
$wgTitle = Title::makeTitle( NS_SPECIAL, 'Error' );
$wgArticle = new Article($wgTitle);
-# Site notice
-# FIXME: This is an ugly hack, which wastes runtime on cache hits
-# and raw page views by forcing initialization of the message cache.
-# Try to fake around it for raw at least:
-if( !isset( $_REQUEST['action'] ) || $_REQUEST['action'] != 'raw' ) {
- $notice = wfMsg( 'sitenotice' );
- if($notice == '<sitenotice>') $notice = '';
- # Allow individual wikis to turn it off
- if ( $notice == '-' ) {
- $wgSiteNotice = '';
- } else {
- # if($wgSiteNotice) $notice .= $wgSiteNotice;
- if ($notice == '') {
- $notice = $wgSiteNotice;
- }
- if($notice != '-' && $notice != '') {
- $specialparser = new Parser();
- $parserOutput = $specialparser->parse( $notice, $wgTitle, $wgOut->mParserOptions, false );
- $wgSiteNotice = $parserOutput->getText();
- }
- }
-}
-
wfProfileOut( $fname.'-misc2' );
wfProfileIn( $fname.'-extensions' );