Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -438,6 +438,7 @@ |
439 | 439 | * PROTO_RELATIVE: Output a URL starting with // (protocol-relative URL) |
440 | 440 | * PROTO_CURRENT: Output a URL starting with either http:// or https:// , depending on which protocol was used for the current incoming request |
441 | 441 | * PROTO_CANONICAL: For URLs without a domain, like /w/index.php , use $wgCanonicalServer. For protocol-relative URLs, use the protocol of $wgCanonicalServer |
| 442 | + * PROTO_INTERNAL: Like PROTO_CANONICAL, but uses $wgInternalServer instead of $wgCanonicalServer |
442 | 443 | * |
443 | 444 | * @todo this won't work with current-path-relative URLs |
444 | 445 | * like "subdir/foo.html", etc. |
— | — | @@ -447,9 +448,15 @@ |
448 | 449 | * @return string Fully-qualified URL |
449 | 450 | */ |
450 | 451 | function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) { |
451 | | - global $wgServer, $wgCanonicalServer; |
452 | | - $serverUrl = $defaultProto === PROTO_CANONICAL ? $wgCanonicalServer : $wgServer; |
453 | | - |
| 452 | + global $wgServer, $wgCanonicalServer, $wgInternalServer; |
| 453 | + $serverUrl = $wgServer; |
| 454 | + if ( $defaultProto === PROTO_CANONICAL ) { |
| 455 | + $serverUrl = $wgCanonicalServer; |
| 456 | + } |
| 457 | + // Make $wgInternalServer fall back to $wgServer if not set |
| 458 | + if ( $defaultProto === PROTO_INTERNAL && $wgInternalServer !== false ) { |
| 459 | + $serverUrl = $wgInternalServer; |
| 460 | + } |
454 | 461 | if ( $defaultProto === PROTO_CURRENT ) { |
455 | 462 | $defaultProto = WebRequest::detectProtocol() . '://'; |
456 | 463 | } |
— | — | @@ -458,11 +465,11 @@ |
459 | 466 | $bits = wfParseUrl( $serverUrl ); |
460 | 467 | $serverHasProto = $bits && $bits['scheme'] != ''; |
461 | 468 | |
462 | | - if ( $defaultProto === PROTO_CANONICAL ) { |
| 469 | + if ( $defaultProto === PROTO_CANONICAL || $defaultProto === PROTO_INTERNAL ) { |
463 | 470 | if ( $serverHasProto ) { |
464 | 471 | $defaultProto = $bits['scheme'] . '://'; |
465 | 472 | } else { |
466 | | - // $wgCanonicalServer doesn't have a protocol. This really isn't supposed to happen |
| 473 | + // $wgCanonicalServer or $wgInternalServer doesn't have a protocol. This really isn't supposed to happen |
467 | 474 | // Fall back to HTTP in this ridiculous case |
468 | 475 | $defaultProto = PROTO_HTTP; |
469 | 476 | } |
Index: trunk/phase3/includes/cache/SquidUpdate.php |
— | — | @@ -221,11 +221,6 @@ |
222 | 222 | * @return string |
223 | 223 | */ |
224 | 224 | static function expand( $url ) { |
225 | | - global $wgInternalServer, $wgServer; |
226 | | - $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer; |
227 | | - if( $url !== '' && $url[0] == '/' ) { |
228 | | - return $server . $url; |
229 | | - } |
230 | | - return $url; |
| 225 | + return wfExpandUrl( $url, PROTO_INTERNAL ); |
231 | 226 | } |
232 | 227 | } |