From 8411b6df62ea7c22b86784a51eb73c4deb735431 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 8 Mar 2011 06:38:15 +0000 Subject: [PATCH] Set $wgInternalServer to false by default, and fall back to $wgServer in the referring code. This avoids having squid updates break when $wgServer is set in configuration but $wgInternalServer is neglected. For immediate deployment, tested locally. --- includes/DefaultSettings.php | 2 +- includes/SquidUpdate.php | 7 ++++--- includes/Title.php | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index aabab5bfc9..339dc037da 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1768,7 +1768,7 @@ $wgUseXVO = false; * $wgInternalServer = 'http://yourinternal.tld:8000'; * */ -$wgInternalServer = $wgServer; +$wgInternalServer = false; /** * Cache timeout for the squid, will be sent as s-maxage (without ESI) or diff --git a/includes/SquidUpdate.php b/includes/SquidUpdate.php index 31f7aa68b1..91f1d283fa 100644 --- a/includes/SquidUpdate.php +++ b/includes/SquidUpdate.php @@ -193,9 +193,10 @@ class SquidUpdate { * @return string */ static function expand( $url ) { - global $wgInternalServer; - if( $url != '' && $url{0} == '/' ) { - return $wgInternalServer . $url; + global $wgInternalServer, $wgServer; + $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer; + if( $url !== '' && $url[0] == '/' ) { + return $server . $url; } return $url; } diff --git a/includes/Title.php b/includes/Title.php index 59a0803a68..a992bc99ee 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -990,8 +990,9 @@ class Title { * @return String the URL */ public function getInternalURL( $query = '', $variant = false ) { - global $wgInternalServer; - $url = $wgInternalServer . $this->getLocalURL( $query, $variant ); + global $wgInternalServer, $wgServer; + $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer; + $url = $server . $this->getLocalURL( $query, $variant ); wfRunHooks( 'GetInternalURL', array( &$this, &$url, $query ) ); return $url; } -- 2.20.1