r96439 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96438‎ | r96439 | r96440 >
Date:14:20, 7 September 2011
Author:catrope
Status:ok
Tags:
Comment:
1.17wmf1: MFT r96437, r96438
Modified paths:
  • /branches/wmf/1.17wmf1/includes/Defines.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/GlobalFunctions.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/SquidUpdate.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/Defines.php
@@ -264,3 +264,4 @@
265265 define( 'PROTO_RELATIVE', '//' );
266266 define( 'PROTO_CURRENT', null );
267267 define( 'PROTO_CANONICAL', 1 );
 268+define( 'PROTO_INTERNAL', 2 );
Property changes on: branches/wmf/1.17wmf1/includes/Defines.php
___________________________________________________________________
Modified: svn:mergeinfo
268269 Merged /trunk/phase3/includes/Defines.php:r96438
Index: branches/wmf/1.17wmf1/includes/GlobalFunctions.php
@@ -1461,6 +1461,7 @@
14621462 * PROTO_RELATIVE: Output a URL starting with // (protocol-relative URL)
14631463 * PROTO_CURRENT: Output a URL starting with either http:// or https:// , depending on which protocol was used for the current incoming request
14641464 * PROTO_CANONICAL: For URLs without a domain, like /w/index.php , use $wgCanonicalServer. For protocol-relative URLs, use the protocol of $wgCanonicalServer
 1465+ * PROTO_INTERNAL: Like PROTO_CANONICAL, but uses $wgInternalServer instead of $wgCanonicalServer
14651466 *
14661467 * @todo this won't work with current-path-relative URLs
14671468 * like "subdir/foo.html", etc.
@@ -1470,9 +1471,15 @@
14711472 * @return string Fully-qualified URL
14721473 */
14731474 function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) {
1474 - global $wgServer, $wgCanonicalServer;
1475 - $serverUrl = $defaultProto === PROTO_CANONICAL ? $wgCanonicalServer : $wgServer;
1476 -
 1475+ global $wgServer, $wgCanonicalServer, $wgInternalServer;
 1476+ $serverUrl = $wgServer;
 1477+ if ( $defaultProto === PROTO_CANONICAL ) {
 1478+ $serverUrl = $wgCanonicalServer;
 1479+ }
 1480+ // Make $wgInternalServer fall back to $wgServer if not set
 1481+ if ( $defaultProto === PROTO_INTERNAL && $wgInternalServer !== false ) {
 1482+ $serverUrl = $wgInternalServer;
 1483+ }
14771484 if ( $defaultProto === PROTO_CURRENT ) {
14781485 $defaultProto = WebRequest::detectProtocol() . '://';
14791486 }
@@ -1481,11 +1488,11 @@
14821489 $bits = wfParseUrl( $serverUrl );
14831490 $serverHasProto = $bits && $bits['scheme'] != '';
14841491
1485 - if ( $defaultProto === PROTO_CANONICAL ) {
 1492+ if ( $defaultProto === PROTO_CANONICAL || $defaultProto === PROTO_INTERNAL ) {
14861493 if ( $serverHasProto ) {
14871494 $defaultProto = $bits['scheme'] . '://';
14881495 } else {
1489 - // $wgCanonicalServer doesn't have a protocol. This really isn't supposed to happen
 1496+ // $wgCanonicalServer or $wgInternalServer doesn't have a protocol. This really isn't supposed to happen
14901497 // Fall back to HTTP in this ridiculous case
14911498 $defaultProto = PROTO_HTTP;
14921499 }
Index: branches/wmf/1.17wmf1/includes/SquidUpdate.php
@@ -208,11 +208,6 @@
209209 * @return string
210210 */
211211 static function expand( $url ) {
212 - global $wgInternalServer, $wgServer;
213 - $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer;
214 - if( $url !== '' && $url[0] == '/' ) {
215 - return $server . $url;
216 - }
217 - return $url;
 212+ return wfExpandUrl( $url, PROTO_INTERNAL );
218213 }
219214 }
Property changes on: branches/wmf/1.17wmf1/includes/SquidUpdate.php
___________________________________________________________________
Modified: svn:mergeinfo
220215 Merged /trunk/phase3/includes/cache/SquidUpdate.php:r96437

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96437Actually fix bug 30792, despite my earlier claims. SquidUpdate::purge('//uplo...catrope14:15, 7 September 2011
r96438Followup r96437: actually define PROTO_INTERNALcatrope14:17, 7 September 2011

Status & tagging log