Index: branches/wmf/1.18wmf1/includes/Defines.php |
— | — | @@ -249,3 +249,4 @@ |
250 | 250 | define( 'PROTO_RELATIVE', '//' ); |
251 | 251 | define( 'PROTO_CURRENT', null ); |
252 | 252 | define( 'PROTO_CANONICAL', 1 ); |
| 253 | +define( 'PROTO_INTERNAL', 2 ); |
Property changes on: branches/wmf/1.18wmf1/includes/Defines.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
253 | 254 | Merged /trunk/phase3/includes/Defines.php:r93438,96437-96438 |
Index: branches/wmf/1.18wmf1/includes/GlobalFunctions.php |
— | — | @@ -433,6 +433,7 @@ |
434 | 434 | * PROTO_RELATIVE: Output a URL starting with // (protocol-relative URL) |
435 | 435 | * PROTO_CURRENT: Output a URL starting with either http:// or https:// , depending on which protocol was used for the current incoming request |
436 | 436 | * PROTO_CANONICAL: For URLs without a domain, like /w/index.php , use $wgCanonicalServer. For protocol-relative URLs, use the protocol of $wgCanonicalServer |
| 437 | + * PROTO_INTERNAL: Like PROTO_CANONICAL, but uses $wgInternalServer instead of $wgCanonicalServer |
437 | 438 | * |
438 | 439 | * @todo this won't work with current-path-relative URLs |
439 | 440 | * like "subdir/foo.html", etc. |
— | — | @@ -442,9 +443,15 @@ |
443 | 444 | * @return string Fully-qualified URL |
444 | 445 | */ |
445 | 446 | function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) { |
446 | | - global $wgServer, $wgCanonicalServer; |
447 | | - $serverUrl = $defaultProto === PROTO_CANONICAL ? $wgCanonicalServer : $wgServer; |
448 | | - |
| 447 | + global $wgServer, $wgCanonicalServer, $wgInternalServer; |
| 448 | + $serverUrl = $wgServer; |
| 449 | + if ( $defaultProto === PROTO_CANONICAL ) { |
| 450 | + $serverUrl = $wgCanonicalServer; |
| 451 | + } |
| 452 | + // Make $wgInternalServer fall back to $wgServer if not set |
| 453 | + if ( $defaultProto === PROTO_INTERNAL && $wgInternalServer !== false ) { |
| 454 | + $serverUrl = $wgInternalServer; |
| 455 | + } |
449 | 456 | if ( $defaultProto === PROTO_CURRENT ) { |
450 | 457 | $defaultProto = WebRequest::detectProtocol() . '://'; |
451 | 458 | } |
— | — | @@ -453,11 +460,11 @@ |
454 | 461 | $bits = wfParseUrl( $serverUrl ); |
455 | 462 | $serverHasProto = $bits && $bits['scheme'] != ''; |
456 | 463 | |
457 | | - if ( $defaultProto === PROTO_CANONICAL ) { |
| 464 | + if ( $defaultProto === PROTO_CANONICAL || $defaultProto === PROTO_INTERNAL ) { |
458 | 465 | if ( $serverHasProto ) { |
459 | 466 | $defaultProto = $bits['scheme'] . '://'; |
460 | 467 | } else { |
461 | | - // $wgCanonicalServer doesn't have a protocol. This really isn't supposed to happen |
| 468 | + // $wgCanonicalServer or $wgInternalServer doesn't have a protocol. This really isn't supposed to happen |
462 | 469 | // Fall back to HTTP in this ridiculous case |
463 | 470 | $defaultProto = PROTO_HTTP; |
464 | 471 | } |
Property changes on: branches/wmf/1.18wmf1/includes/GlobalFunctions.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
465 | 472 | Merged /trunk/phase3/includes/GlobalFunctions.php:r93438,96437 |
Index: branches/wmf/1.18wmf1/includes/cache/SquidUpdate.php |
— | — | @@ -235,11 +235,6 @@ |
236 | 236 | * @return string |
237 | 237 | */ |
238 | 238 | static function expand( $url ) { |
239 | | - global $wgInternalServer, $wgServer; |
240 | | - $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer; |
241 | | - if( $url !== '' && $url[0] == '/' ) { |
242 | | - return $server . $url; |
243 | | - } |
244 | | - return $url; |
| 239 | + return wfExpandUrl( $url, PROTO_INTERNAL ); |
245 | 240 | } |
246 | 241 | } |