Index: branches/wmf/1.17wmf1/includes/Defines.php |
— | — | @@ -264,3 +264,4 @@ |
265 | 265 | define( 'PROTO_RELATIVE', '//' ); |
266 | 266 | define( 'PROTO_CURRENT', null ); |
267 | 267 | define( 'PROTO_CANONICAL', 1 ); |
| 268 | +define( 'PROTO_INTERNAL', 2 ); |
Property changes on: branches/wmf/1.17wmf1/includes/Defines.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
268 | 269 | Merged /trunk/phase3/includes/Defines.php:r96438 |
Index: branches/wmf/1.17wmf1/includes/GlobalFunctions.php |
— | — | @@ -1461,6 +1461,7 @@ |
1462 | 1462 | * PROTO_RELATIVE: Output a URL starting with // (protocol-relative URL) |
1463 | 1463 | * PROTO_CURRENT: Output a URL starting with either http:// or https:// , depending on which protocol was used for the current incoming request |
1464 | 1464 | * 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 |
1465 | 1466 | * |
1466 | 1467 | * @todo this won't work with current-path-relative URLs |
1467 | 1468 | * like "subdir/foo.html", etc. |
— | — | @@ -1470,9 +1471,15 @@ |
1471 | 1472 | * @return string Fully-qualified URL |
1472 | 1473 | */ |
1473 | 1474 | 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 | + } |
1477 | 1484 | if ( $defaultProto === PROTO_CURRENT ) { |
1478 | 1485 | $defaultProto = WebRequest::detectProtocol() . '://'; |
1479 | 1486 | } |
— | — | @@ -1481,11 +1488,11 @@ |
1482 | 1489 | $bits = wfParseUrl( $serverUrl ); |
1483 | 1490 | $serverHasProto = $bits && $bits['scheme'] != ''; |
1484 | 1491 | |
1485 | | - if ( $defaultProto === PROTO_CANONICAL ) { |
| 1492 | + if ( $defaultProto === PROTO_CANONICAL || $defaultProto === PROTO_INTERNAL ) { |
1486 | 1493 | if ( $serverHasProto ) { |
1487 | 1494 | $defaultProto = $bits['scheme'] . '://'; |
1488 | 1495 | } 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 |
1490 | 1497 | // Fall back to HTTP in this ridiculous case |
1491 | 1498 | $defaultProto = PROTO_HTTP; |
1492 | 1499 | } |
Index: branches/wmf/1.17wmf1/includes/SquidUpdate.php |
— | — | @@ -208,11 +208,6 @@ |
209 | 209 | * @return string |
210 | 210 | */ |
211 | 211 | 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 ); |
218 | 213 | } |
219 | 214 | } |
Property changes on: branches/wmf/1.17wmf1/includes/SquidUpdate.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
220 | 215 | Merged /trunk/phase3/includes/cache/SquidUpdate.php:r96437 |