Index: branches/wmf/1.17wmf1/maintenance/generateSitemap.php |
— | — | @@ -288,7 +288,7 @@ |
289 | 289 | } |
290 | 290 | $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
291 | 291 | $date = wfTimestamp( TS_ISO_8601, $row->page_touched ); |
292 | | - $entry = $this->fileEntry( $title->getFullURL(), $date, $this->priority( $namespace ) ); |
| 292 | + $entry = $this->fileEntry( $title->getCanonicalURL(), $date, $this->priority( $namespace ) ); |
293 | 293 | $length += strlen( $entry ); |
294 | 294 | $this->write( $this->file, $entry ); |
295 | 295 | // generate pages for language variants |
— | — | @@ -296,7 +296,7 @@ |
297 | 297 | $variants = $wgContLang->getVariants(); |
298 | 298 | foreach ( $variants as $vCode ) { |
299 | 299 | if ( $vCode == $wgContLang->getCode() ) continue; // we don't want default variant |
300 | | - $entry = $this->fileEntry( $title->getFullURL( '', $vCode ), $date, $this->priority( $namespace ) ); |
| 300 | + $entry = $this->fileEntry( $title->getCanonicalURL( '', $vCode ), $date, $this->priority( $namespace ) ); |
301 | 301 | $length += strlen( $entry ); |
302 | 302 | $this->write( $this->file, $entry ); |
303 | 303 | } |
— | — | @@ -445,7 +445,7 @@ |
446 | 446 | |
447 | 447 | $this->limit = array( |
448 | 448 | strlen( $this->openFile() ), |
449 | | - strlen( $this->fileEntry( $title->getFullUrl(), wfTimestamp( TS_ISO_8601, wfTimestamp() ), $this->priority( $namespace ) ) ), |
| 449 | + strlen( $this->fileEntry( $title->getCanonicalURL(), wfTimestamp( TS_ISO_8601, wfTimestamp() ), $this->priority( $namespace ) ) ), |
450 | 450 | strlen( $this->closeFile() ) |
451 | 451 | ); |
452 | 452 | } |
Index: branches/wmf/1.17wmf1/maintenance/purgeList.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | } elseif ( $page !== '' ) { |
42 | 42 | $title = Title::newFromText( $page ); |
43 | 43 | if ( $title ) { |
44 | | - $url = $title->getFullUrl(); |
| 44 | + $url = $title->getInternalUrl(); |
45 | 45 | $this->output( "$url\n" ); |
46 | 46 | $urls[] = $url; |
47 | 47 | if ( $this->getOption( 'purge' ) ) { |
Index: branches/wmf/1.17wmf1/includes/FileRevertForm.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | $wgOut->addHTML( wfMsgExt( 'filerevert-success', 'parse', $this->title->getText(), |
74 | 74 | $wgLang->date( $this->getTimestamp(), true ), |
75 | 75 | $wgLang->time( $this->getTimestamp(), true ), |
76 | | - wfExpandUrl( $this->file->getArchiveUrl( $this->archiveName ) ) ) ); |
| 76 | + wfExpandUrl( $this->file->getArchiveUrl( $this->archiveName ), PROTO_CURRENT ) ) ); |
77 | 77 | $wgOut->returnToMain( false, $this->title ); |
78 | 78 | } else { |
79 | 79 | $wgOut->addWikiText( $status->getWikiText() ); |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | $form .= '<fieldset><legend>' . wfMsgHtml( 'filerevert-legend' ) . '</legend>'; |
98 | 98 | $form .= wfMsgExt( 'filerevert-intro', 'parse', $this->title->getText(), |
99 | 99 | $wgLang->date( $timestamp, true ), $wgLang->time( $timestamp, true ), |
100 | | - wfExpandUrl( $this->file->getArchiveUrl( $this->archiveName ) ) ); |
| 100 | + wfExpandUrl( $this->file->getArchiveUrl( $this->archiveName ), PROTO_CURRENT ) ); |
101 | 101 | $form .= '<p>' . Xml::inputLabel( wfMsg( 'filerevert-comment' ), 'wpComment', 'wpComment', |
102 | 102 | 60, wfMsgForContent( 'filerevert-defaultcomment', |
103 | 103 | $wgContLang->date( $timestamp, false, false ), $wgContLang->time( $timestamp, false, false ) ) ) . '</p>'; |
Index: branches/wmf/1.17wmf1/includes/ProxyTools.php |
— | — | @@ -168,7 +168,7 @@ |
169 | 169 | if ( !$skip ) { |
170 | 170 | $title = SpecialPage::getTitleFor( 'Blockme' ); |
171 | 171 | $iphash = md5( $ip . $wgProxyKey ); |
172 | | - $url = $title->getFullURL( 'ip='.$iphash ); |
| 172 | + $url = wfExpandUrl( $title->getFullURL( 'ip='.$iphash ), PROTO_HTTP ); |
173 | 173 | |
174 | 174 | foreach ( $wgProxyPorts as $port ) { |
175 | 175 | $params = implode( ' ', array( |
Index: branches/wmf/1.17wmf1/includes/Defines.php |
— | — | @@ -255,3 +255,12 @@ |
256 | 256 | define( 'APCOND_AGE_FROM_EDIT', 7 ); |
257 | 257 | define( 'APCOND_BLOCKED', 8 ); |
258 | 258 | /**@}*/ |
| 259 | + |
| 260 | +/** |
| 261 | + * Protocol constants for wfExpandUrl() |
| 262 | + */ |
| 263 | +define( 'PROTO_HTTP', 'http://' ); |
| 264 | +define( 'PROTO_HTTPS', 'https://' ); |
| 265 | +define( 'PROTO_RELATIVE', '//' ); |
| 266 | +define( 'PROTO_CURRENT', null ); |
| 267 | +define( 'PROTO_CANONICAL', 1 ); |
Property changes on: branches/wmf/1.17wmf1/includes/Defines.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
259 | 268 | Merged /branches/new-installer/phase3/includes/Defines.php:r43664-66004 |
260 | 269 | Merged /branches/wmf-deployment/includes/Defines.php:r53381,60970 |
261 | 270 | Merged /branches/REL1_15/phase3/includes/Defines.php:r51646 |
262 | 271 | Merged /branches/wmf/1.16wmf4/includes/Defines.php:r67177,69199,76243,77266 |
263 | 272 | Merged /branches/sqlite/includes/Defines.php:r58211-58321 |
264 | 273 | Merged /trunk/phase3/includes/Defines.php:r83590,89512-89513,93847,94990,94996,95000-95002,95006-95007,95010-95011,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/User.php |
— | — | @@ -3047,14 +3047,14 @@ |
3048 | 3048 | * @return \string Formatted URL |
3049 | 3049 | */ |
3050 | 3050 | protected function getTokenUrl( $page, $token ) { |
3051 | | - global $wgArticlePath; |
3052 | | - return wfExpandUrl( |
| 3051 | + global $wgCanonicalServer, $wgArticlePath; |
| 3052 | + |
| 3053 | + return $wgCanonicalServer . |
3053 | 3054 | str_replace( |
3054 | 3055 | '$1', |
3055 | 3056 | "Special:$page/$token", |
3056 | | - $wgArticlePath ), |
3057 | | - PROTO_HTTP |
3058 | | - ); |
| 3057 | + $wgArticlePath |
| 3058 | + ); |
3059 | 3059 | } |
3060 | 3060 | |
3061 | 3061 | /** |
Property changes on: branches/wmf/1.17wmf1/includes/User.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
3062 | 3062 | Merged /trunk/phase3/includes/User.php:r93847,94990,94996,95000-95002,95007,95010-95011,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/search/SearchEngine.php |
— | — | @@ -434,13 +434,13 @@ |
435 | 435 | * @return String |
436 | 436 | */ |
437 | 437 | public static function getOpenSearchTemplate() { |
438 | | - global $wgOpenSearchTemplate, $wgServer, $wgScriptPath; |
| 438 | + global $wgOpenSearchTemplate, $wgCanonicalServer, $wgScriptPath; |
439 | 439 | if ( $wgOpenSearchTemplate ) { |
440 | 440 | return $wgOpenSearchTemplate; |
441 | 441 | } else { |
442 | 442 | $ns = implode( '|', SearchEngine::defaultNamespaces() ); |
443 | 443 | if ( !$ns ) $ns = "0"; |
444 | | - return $wgServer . $wgScriptPath . '/api.php?action=opensearch&search={searchTerms}&namespace=' . $ns; |
| 444 | + return $wgCanonicalServer . $wgScriptPath . '/api.php?action=opensearch&search={searchTerms}&namespace=' . $ns; |
445 | 445 | } |
446 | 446 | } |
447 | 447 | |
Index: branches/wmf/1.17wmf1/includes/diff/DifferenceEngine.php |
— | — | @@ -122,14 +122,14 @@ |
123 | 123 | # we'll use the application/x-external-editor interface to call |
124 | 124 | # an external diff tool like kompare, kdiff3, etc. |
125 | 125 | if ( $wgUseExternalEditor && $wgUser->getOption( 'externaldiff' ) ) { |
126 | | - global $wgInputEncoding, $wgServer, $wgScript, $wgLang; |
| 126 | + global $wgInputEncoding, $wgCanonicalServer, $wgScript, $wgLang; |
127 | 127 | $wgOut->disable(); |
128 | 128 | header ( "Content-type: application/x-external-editor; charset=" . $wgInputEncoding ); |
129 | | - $url1 = $this->mTitle->getFullURL( array( |
| 129 | + $url1 = $this->mTitle->getCanonicalURL( array( |
130 | 130 | 'action' => 'raw', |
131 | 131 | 'oldid' => $this->mOldid |
132 | 132 | ) ); |
133 | | - $url2 = $this->mTitle->getFullURL( array( |
| 133 | + $url2 = $this->mTitle->getCanonicalURL( array( |
134 | 134 | 'action' => 'raw', |
135 | 135 | 'oldid' => $this->mNewid |
136 | 136 | ) ); |
— | — | @@ -138,7 +138,7 @@ |
139 | 139 | [Process] |
140 | 140 | Type=Diff text |
141 | 141 | Engine=MediaWiki |
142 | | - Script={$wgServer}{$wgScript} |
| 142 | + Script={$wgCanonicalServer}{$wgScript} |
143 | 143 | Special namespace={$special} |
144 | 144 | |
145 | 145 | [File] |
Property changes on: branches/wmf/1.17wmf1/includes/diff/DifferenceEngine.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
146 | 146 | Merged /trunk/phase3/includes/diff/DifferenceEngine.php:r94990,94996,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/RecentChange.php |
— | — | @@ -614,7 +614,8 @@ |
615 | 615 | } |
616 | 616 | |
617 | 617 | public function getIRCLine() { |
618 | | - global $wgUseRCPatrol, $wgUseNPPatrol, $wgRC2UDPInterwikiPrefix, $wgLocalInterwiki; |
| 618 | + global $wgUseRCPatrol, $wgUseNPPatrol, $wgRC2UDPInterwikiPrefix, $wgLocalInterwiki, |
| 619 | + $wgCanonicalServer, $wgScript; |
619 | 620 | |
620 | 621 | // FIXME: Would be good to replace these 2 extract() calls with something more explicit |
621 | 622 | // e.g. list ($rc_type, $rc_id) = array_values ($this->mAttribs); [or something like that] |
— | — | @@ -632,21 +633,18 @@ |
633 | 634 | if( $rc_type == RC_LOG ) { |
634 | 635 | $url = ''; |
635 | 636 | } else { |
| 637 | + $url = $wgCanonicalServer . $wgScript; |
636 | 638 | if( $rc_type == RC_NEW ) { |
637 | | - $url = "oldid=$rc_this_oldid"; |
| 639 | + $query = "?oldid=$rc_this_oldid"; |
638 | 640 | } else { |
639 | | - $url = "diff=$rc_this_oldid&oldid=$rc_last_oldid"; |
| 641 | + $query = "?diff=$rc_this_oldid&oldid=$rc_last_oldid"; |
640 | 642 | } |
641 | 643 | if( $wgUseRCPatrol || ($rc_type == RC_NEW && $wgUseNPPatrol) ) { |
642 | | - $url .= "&rcid=$rc_id"; |
| 644 | + $query .= "&rcid=$rc_id"; |
643 | 645 | } |
644 | | - // XXX: *HACK* this should use getFullURL(), hacked for SSL madness --brion 2005-12-26 |
645 | | - // XXX: *HACK^2* the preg_replace() undoes much of what getInternalURL() does, but we |
646 | | - // XXX: need to call it so that URL paths on the Wikimedia secure server can be fixed |
647 | | - // XXX: by a custom GetInternalURL hook --vyznev 2008-12-10 |
648 | | - // XXX: Also, getInternalUrl() may return a protocol-relative URL. |
649 | | - // XXX: In that case, expand it to an HTTP URL, even if this is an HTTPS request --catrope 2011-08-17 |
650 | | - $url = preg_replace( '/title=[^&]*&/', '', wfExpandUrl( $titleObj->getInternalURL( $url ), PROTO_HTTP ) ); |
| 646 | + // HACK: We need this hook for WMF's secure server setup |
| 647 | + wfRunHooks( 'IRCLineURL', array( &$url, &$query ) ); |
| 648 | + $url .= $query; |
651 | 649 | } |
652 | 650 | |
653 | 651 | if( isset( $oldSize ) && isset( $newSize ) ) { |
Property changes on: branches/wmf/1.17wmf1/includes/RecentChange.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
654 | 652 | Merged /trunk/phase3/includes/RecentChange.php:r93847,94990,94995-94996,95000-95002,95007,95010-95011,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/GlobalFunctions.php |
— | — | @@ -1465,6 +1465,7 @@ |
1466 | 1466 | * PROTO_HTTPS: Output a URL starting with https:// |
1467 | 1467 | * PROTO_RELATIVE: Output a URL starting with // (protocol-relative URL) |
1468 | 1468 | * PROTO_CURRENT: Output a URL starting with either http:// or https:// , depending on which protocol was used for the current incoming request |
| 1469 | + * PROTO_CANONICAL: For URLs without a domain, like /w/index.php , use $wgCanonicalServer. For protocol-relative URLs, use the protocol of $wgCanonicalServer |
1469 | 1470 | * |
1470 | 1471 | * @todo this won't work with current-path-relative URLs |
1471 | 1472 | * like "subdir/foo.html", etc. |
— | — | @@ -1474,21 +1475,34 @@ |
1475 | 1476 | * @return string Fully-qualified URL |
1476 | 1477 | */ |
1477 | 1478 | function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) { |
1478 | | - global $wgServer; |
| 1479 | + global $wgServer, $wgCanonicalServer; |
| 1480 | + $serverUrl = $defaultProto === PROTO_CANONICAL ? $wgCanonicalServer : $wgServer; |
| 1481 | + |
1479 | 1482 | if ( $defaultProto === PROTO_CURRENT ) { |
1480 | 1483 | $defaultProto = WebRequest::detectProtocol() . '://'; |
1481 | 1484 | } |
1482 | 1485 | |
1483 | | - // Analyze $wgServer to obtain its protocol |
1484 | | - $bits = wfParseUrl( $wgServer ); |
| 1486 | + // Analyze $serverUrl to obtain its protocol |
| 1487 | + $bits = wfParseUrl( $serverUrl ); |
1485 | 1488 | $serverHasProto = $bits && $bits['scheme'] != ''; |
| 1489 | + |
| 1490 | + if ( $defaultProto === PROTO_CANONICAL ) { |
| 1491 | + if ( $serverHasProto ) { |
| 1492 | + $defaultProto = $bits['scheme'] . '://'; |
| 1493 | + } else { |
| 1494 | + // $wgCanonicalServer doesn't have a protocol. This really isn't supposed to happen |
| 1495 | + // Fall back to HTTP in this ridiculous case |
| 1496 | + $defaultProto = PROTO_HTTP; |
| 1497 | + } |
| 1498 | + } |
| 1499 | + |
1486 | 1500 | $defaultProtoWithoutSlashes = substr( $defaultProto, 0, -2 ); |
1487 | 1501 | |
1488 | 1502 | if( substr( $url, 0, 2 ) == '//' ) { |
1489 | 1503 | return $defaultProtoWithoutSlashes . $url; |
1490 | 1504 | } elseif( substr( $url, 0, 1 ) == '/' ) { |
1491 | | - // If $wgServer is protocol-relative, prepend $defaultProtoWithoutSlashes, otherwise leave it alone |
1492 | | - return ( $serverHasProto ? '' : $defaultProtoWithoutSlashes ) . $wgServer . $url; |
| 1505 | + // If $serverUrl is protocol-relative, prepend $defaultProtoWithoutSlashes, otherwise leave it alone |
| 1506 | + return ( $serverHasProto ? '' : $defaultProtoWithoutSlashes ) . $serverUrl . $url; |
1493 | 1507 | } else { |
1494 | 1508 | return $url; |
1495 | 1509 | } |
Property changes on: branches/wmf/1.17wmf1/includes/GlobalFunctions.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
1496 | 1510 | Merged /trunk/phase3/includes/GlobalFunctions.php:r93847,94990,94996,95000-95002,95006-95007,95010-95011,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/parser/CoreParserFunctions.php |
— | — | @@ -31,6 +31,8 @@ |
32 | 32 | $parser->setFunctionHook( 'localurle', array( __CLASS__, 'localurle' ), SFH_NO_HASH ); |
33 | 33 | $parser->setFunctionHook( 'fullurl', array( __CLASS__, 'fullurl' ), SFH_NO_HASH ); |
34 | 34 | $parser->setFunctionHook( 'fullurle', array( __CLASS__, 'fullurle' ), SFH_NO_HASH ); |
| 35 | + $parser->setFunctionHook( 'canonicalurl', array( __CLASS__, 'canonicalurl' ), SFH_NO_HASH ); |
| 36 | + $parser->setFunctionHook( 'canonicalurle', array( __CLASS__, 'canonicalurle' ), SFH_NO_HASH ); |
35 | 37 | $parser->setFunctionHook( 'formatnum', array( __CLASS__, 'formatnum' ), SFH_NO_HASH ); |
36 | 38 | $parser->setFunctionHook( 'grammar', array( __CLASS__, 'grammar' ), SFH_NO_HASH ); |
37 | 39 | $parser->setFunctionHook( 'gender', array( __CLASS__, 'gender' ), SFH_NO_HASH ); |
— | — | @@ -194,6 +196,8 @@ |
195 | 197 | static function localurle( $parser, $s = '', $arg = null ) { return self::urlFunction( 'escapeLocalURL', $s, $arg ); } |
196 | 198 | static function fullurl( $parser, $s = '', $arg = null ) { return self::urlFunction( 'getFullURL', $s, $arg ); } |
197 | 199 | static function fullurle( $parser, $s = '', $arg = null ) { return self::urlFunction( 'escapeFullURL', $s, $arg ); } |
| 200 | + static function canonicalurl( $parser, $s = '', $arg = null ) { return self::urlFunction( 'getCanonicalURL', $s, $arg ); } |
| 201 | + static function canonicalurle( $parser, $s = '', $arg = null ) { return self::urlFunction( 'escapeCanonicalURL', $s, $arg ); } |
198 | 202 | |
199 | 203 | static function urlFunction( $func, $s = '', $arg = null ) { |
200 | 204 | $title = Title::newFromText( $s ); |
Index: branches/wmf/1.17wmf1/includes/ExternalEdit.php |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | } |
31 | 31 | |
32 | 32 | function edit() { |
33 | | - global $wgOut, $wgScript, $wgScriptPath, $wgServer, $wgLang; |
| 33 | + global $wgOut, $wgScript, $wgScriptPath, $wgCanonicalServer, $wgLang; |
34 | 34 | $wgOut->disable(); |
35 | 35 | $name=$this->mTitle->getText(); |
36 | 36 | $pos=strrpos($name,".")+1; |
— | — | @@ -41,14 +41,14 @@ |
42 | 42 | # details. |
43 | 43 | if(!isset($this->mMode)) { |
44 | 44 | $type="Edit text"; |
45 | | - $url=$this->mTitle->getFullURL("action=edit&internaledit=true"); |
| 45 | + $url=$this->mTitle->getCanonicalURL("action=edit&internaledit=true"); |
46 | 46 | # *.wiki file extension is used by some editors for syntax |
47 | 47 | # highlighting, so we follow that convention |
48 | 48 | $extension="wiki"; |
49 | 49 | } elseif($this->mMode=="file") { |
50 | 50 | $type="Edit file"; |
51 | 51 | $image = wfLocalFile( $this->mTitle ); |
52 | | - $url = $image->getFullURL(); |
| 52 | + $url = $image->getCanonicalURL(); |
53 | 53 | $extension=substr($name, $pos); |
54 | 54 | } |
55 | 55 | $special=$wgLang->getNsText(NS_SPECIAL); |
— | — | @@ -56,8 +56,8 @@ |
57 | 57 | [Process] |
58 | 58 | Type=$type |
59 | 59 | Engine=MediaWiki |
60 | | -Script={$wgServer}{$wgScript} |
61 | | -Server={$wgServer} |
| 60 | +Script={$wgCanonicalServer}{$wgScript} |
| 61 | +Server={$wgCanonicalServer} |
62 | 62 | Path={$wgScriptPath} |
63 | 63 | Special namespace=$special |
64 | 64 | |
Index: branches/wmf/1.17wmf1/includes/Setup.php |
— | — | @@ -191,6 +191,12 @@ |
192 | 192 | require_once( "$IP/includes/ProxyTools.php" ); |
193 | 193 | require_once( "$IP/includes/ImageFunctions.php" ); |
194 | 194 | wfProfileOut( $fname.'-includes' ); |
| 195 | + |
| 196 | +# Now that GlobalFunctions is loaded, set the default for $wgCanonicalServer |
| 197 | +if ( $wgCanonicalServer === false ) { |
| 198 | + $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP ); |
| 199 | +} |
| 200 | + |
195 | 201 | wfProfileIn( $fname.'-misc1' ); |
196 | 202 | |
197 | 203 | # Raise the memory limit if it's too low |
Index: branches/wmf/1.17wmf1/includes/Feed.php |
— | — | @@ -222,12 +222,15 @@ |
223 | 223 | * but can also be called separately. |
224 | 224 | */ |
225 | 225 | public function httpHeaders() { |
226 | | - global $wgOut; |
| 226 | + global $wgOut, $wgVaryOnXFPForAPI; |
227 | 227 | |
228 | 228 | # We take over from $wgOut, excepting its cache header info |
229 | 229 | $wgOut->disable(); |
230 | 230 | $mimetype = $this->contentType(); |
231 | 231 | header( "Content-type: $mimetype; charset=UTF-8" ); |
| 232 | + if ( $wgVaryOnXFPForAPI ) { |
| 233 | + $wgOut->addVaryHeader( 'X-Forwarded-Proto' ); |
| 234 | + } |
232 | 235 | $wgOut->sendCacheControl(); |
233 | 236 | |
234 | 237 | } |
— | — | @@ -256,7 +259,7 @@ |
257 | 260 | $this->httpHeaders(); |
258 | 261 | echo '<?xml version="1.0"?>' . "\n"; |
259 | 262 | echo '<?xml-stylesheet type="text/css" href="' . |
260 | | - htmlspecialchars( wfExpandUrl( "$wgStylePath/common/feed.css?$wgStyleVersion" ) ) . |
| 263 | + htmlspecialchars( wfExpandUrl( "$wgStylePath/common/feed.css?$wgStyleVersion", PROTO_CURRENT ) ) . |
261 | 264 | '"?' . ">\n"; |
262 | 265 | } |
263 | 266 | } |
— | — | @@ -288,7 +291,7 @@ |
289 | 292 | ?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"> |
290 | 293 | <channel> |
291 | 294 | <title><?php print $this->getTitle() ?></title> |
292 | | - <link><?php print $this->getUrl() ?></link> |
| 295 | + <link><?php print wfExpandUrl( $this->getUrl(), PROTO_CURRENT ) ?></link> |
293 | 296 | <description><?php print $this->getDescription() ?></description> |
294 | 297 | <language><?php print $this->getLanguage() ?></language> |
295 | 298 | <generator>MediaWiki <?php print $wgVersion ?></generator> |
— | — | @@ -304,12 +307,12 @@ |
305 | 308 | ?> |
306 | 309 | <item> |
307 | 310 | <title><?php print $item->getTitle() ?></title> |
308 | | - <link><?php print $item->getUrl() ?></link> |
| 311 | + <link><?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ) ?></link> |
309 | 312 | <guid<?php if( !$item->RSSIsPermalink ) print ' isPermaLink="false"' ?>><?php print $item->getUniqueId() ?></guid> |
310 | 313 | <description><?php print $item->getDescription() ?></description> |
311 | 314 | <?php if( $item->getDate() ) { ?><pubDate><?php print $this->formatTime( $item->getDate() ) ?></pubDate><?php } ?> |
312 | 315 | <?php if( $item->getAuthor() ) { ?><dc:creator><?php print $item->getAuthor() ?></dc:creator><?php }?> |
313 | | - <?php if( $item->getComments() ) { ?><comments><?php print $item->getComments() ?></comments><?php }?> |
| 316 | + <?php if( $item->getComments() ) { ?><comments><?php print wfExpandUrl( $item->getComments(), PROTO_CURRENT ) ?></comments><?php }?> |
314 | 317 | </item> |
315 | 318 | <?php |
316 | 319 | } |
— | — | @@ -348,8 +351,8 @@ |
349 | 352 | ?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="<?php print $this->getLanguage() ?>"> |
350 | 353 | <id><?php print $this->getFeedId() ?></id> |
351 | 354 | <title><?php print $this->getTitle() ?></title> |
352 | | - <link rel="self" type="application/atom+xml" href="<?php print $this->getSelfUrl() ?>"/> |
353 | | - <link rel="alternate" type="text/html" href="<?php print $this->getUrl() ?>"/> |
| 355 | + <link rel="self" type="application/atom+xml" href="<?php print wfExpandUrl( $this->getSelfUrl(), PROTO_CURRENT ) ?>"/> |
| 356 | + <link rel="alternate" type="text/html" href="<?php print wfExpandUrl( $this->getUrl(), PROTO_CURRENT ) ?>"/> |
354 | 357 | <updated><?php print $this->formatTime( wfTimestampNow() ) ?>Z</updated> |
355 | 358 | <subtitle><?php print $this->getDescription() ?></subtitle> |
356 | 359 | <generator>MediaWiki <?php print $wgVersion ?></generator> |
— | — | @@ -390,7 +393,7 @@ |
391 | 394 | <entry> |
392 | 395 | <id><?php print $item->getUniqueId() ?></id> |
393 | 396 | <title><?php print $item->getTitle() ?></title> |
394 | | - <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print $item->getUrl() ?>"/> |
| 397 | + <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ) ?>"/> |
395 | 398 | <?php if( $item->getDate() ) { ?> |
396 | 399 | <updated><?php print $this->formatTime( $item->getDate() ) ?>Z</updated> |
397 | 400 | <?php } ?> |
Index: branches/wmf/1.17wmf1/includes/UserMailer.php |
— | — | @@ -466,7 +466,7 @@ |
467 | 467 | $keys = array(); |
468 | 468 | |
469 | 469 | if ( $this->oldid ) { |
470 | | - $difflink = wfExpandUrl( $this->title->getFullUrl( 'diff=0&oldid=' . $this->oldid ), PROTO_HTTP ); |
| 470 | + $difflink = $this->title->getCanonicalUrl( 'diff=0&oldid=' . $this->oldid ); |
471 | 471 | $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited', $difflink ); |
472 | 472 | $keys['$OLDID'] = $this->oldid; |
473 | 473 | $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'changed' ); |
— | — | @@ -483,17 +483,17 @@ |
484 | 484 | * revision. |
485 | 485 | */ |
486 | 486 | $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastdiff', |
487 | | - wfExpandUrl( $this->title->getFullURL( "oldid={$this->oldid}&diff=next" ), PROTO_HTTP ) ); |
| 487 | + $this->title->getCanonicalUrl( "oldid={$this->oldid}&diff=next" ) ); |
488 | 488 | } |
489 | 489 | |
490 | 490 | $body = strtr( $body, $keys ); |
491 | 491 | $pagetitle = $this->title->getPrefixedText(); |
492 | 492 | $keys['$PAGETITLE'] = $pagetitle; |
493 | | - $keys['$PAGETITLE_URL'] = wfExpandUrl( $this->title->getFullUrl(), PROTO_HTTP ); |
| 493 | + $keys['$PAGETITLE_URL'] = $this->title->getCanonicalUrl(); |
494 | 494 | |
495 | 495 | $keys['$PAGEMINOREDIT'] = $medit; |
496 | 496 | $keys['$PAGESUMMARY'] = $summary; |
497 | | - $keys['$UNWATCHURL'] = wfExpandUrl( $this->title->getFullUrl( 'action=unwatch' ), PROTO_HTTP ); |
| 497 | + $keys['$UNWATCHURL'] = $this->title->getCanonicalUrl( 'action=unwatch' ); |
498 | 498 | |
499 | 499 | $subject = strtr( $subject, $keys ); |
500 | 500 | |
— | — | @@ -528,10 +528,10 @@ |
529 | 529 | $subject = str_replace( '$PAGEEDITOR', $name, $subject ); |
530 | 530 | $keys['$PAGEEDITOR'] = $name; |
531 | 531 | $emailPage = SpecialPage::getSafeTitleFor( 'Emailuser', $name ); |
532 | | - $keys['$PAGEEDITOR_EMAIL'] = wfExpandUrl( $emailPage->getFullUrl(), PROTO_HTTP ); |
| 532 | + $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalUrl(); |
533 | 533 | } |
534 | 534 | $userPage = $editor->getUserPage(); |
535 | | - $keys['$PAGEEDITOR_WIKI'] = wfExpandUrl( $userPage->getFullUrl(), PROTO_HTTP ); |
| 535 | + $keys['$PAGEEDITOR_WIKI'] = $userPage->getCanonicalUrl(); |
536 | 536 | $body = strtr( $body, $keys ); |
537 | 537 | $body = wordwrap( $body, 72 ); |
538 | 538 | |
Index: branches/wmf/1.17wmf1/includes/filerepo/File.php |
— | — | @@ -187,8 +187,12 @@ |
188 | 188 | * @return String |
189 | 189 | */ |
190 | 190 | public function getFullUrl() { |
191 | | - return wfExpandUrl( $this->getUrl() ); |
| 191 | + return wfExpandUrl( $this->getUrl(), PROTO_RELATIVE ); |
192 | 192 | } |
| 193 | + |
| 194 | + public function getCanonicalUrl() { |
| 195 | + return wfExpandUrl( $this->getUrl(), PROTO_CANONICAL ); |
| 196 | + } |
193 | 197 | |
194 | 198 | function getViewURL() { |
195 | 199 | if( $this->mustRender()) { |
Property changes on: branches/wmf/1.17wmf1/includes/filerepo/File.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
196 | 200 | Merged /trunk/phase3/includes/filerepo/File.php:r93847,94990,94996,95000-95002,95007,95010-95011,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/Export.php |
— | — | @@ -405,7 +405,7 @@ |
406 | 406 | } |
407 | 407 | |
408 | 408 | function homelink() { |
409 | | - return Xml::element( 'base', array(), Title::newMainPage()->getFullUrl() ); |
| 409 | + return Xml::element( 'base', array(), Title::newMainPage()->getCanonicalUrl() ); |
410 | 410 | } |
411 | 411 | |
412 | 412 | function caseSetting() { |
— | — | @@ -616,7 +616,7 @@ |
617 | 617 | $this->writeContributor( $file->getUser( 'id' ), $file->getUser( 'text' ) ) . |
618 | 618 | " " . Xml::elementClean( 'comment', null, $file->getDescription() ) . "\n" . |
619 | 619 | " " . Xml::element( 'filename', null, $file->getName() ) . "\n" . |
620 | | - " " . Xml::element( 'src', null, $file->getFullUrl() ) . "\n" . |
| 620 | + " " . Xml::element( 'src', null, $file->getCanonicalUrl() ) . "\n" . |
621 | 621 | " " . Xml::element( 'size', null, $file->getSize() ) . "\n" . |
622 | 622 | " </upload>\n"; |
623 | 623 | } |
Index: branches/wmf/1.17wmf1/includes/OutputPage.php |
— | — | @@ -1649,7 +1649,7 @@ |
1650 | 1650 | wfProfileIn( __METHOD__ ); |
1651 | 1651 | if ( $this->mRedirect != '' ) { |
1652 | 1652 | # Standards require redirect URLs to be absolute |
1653 | | - $this->mRedirect = wfExpandUrl( $this->mRedirect ); |
| 1653 | + $this->mRedirect = wfExpandUrl( $this->mRedirect, PROTO_CURRENT ); |
1654 | 1654 | if( $this->mRedirectCode == '301' || $this->mRedirectCode == '303' ) { |
1655 | 1655 | if( !$wgDebugRedirects ) { |
1656 | 1656 | $message = self::getStatusMessage( $this->mRedirectCode ); |
Property changes on: branches/wmf/1.17wmf1/includes/OutputPage.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
1657 | 1657 | Merged /trunk/phase3/includes/OutputPage.php:r94990,94996,95010-95011,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/api/ApiQuerySiteinfo.php |
— | — | @@ -105,7 +105,7 @@ |
106 | 106 | $data = array(); |
107 | 107 | $mainPage = Title::newMainPage(); |
108 | 108 | $data['mainpage'] = $mainPage->getPrefixedText(); |
109 | | - $data['base'] = wfExpandUrl( $mainPage->getFullUrl() ); |
| 109 | + $data['base'] = wfExpandUrl( $mainPage->getFullUrl(), PROTO_CURRENT ); |
110 | 110 | $data['sitename'] = $GLOBALS['wgSitename']; |
111 | 111 | $data['generator'] = "MediaWiki {$GLOBALS['wgVersion']}"; |
112 | 112 | $data['phpversion'] = phpversion(); |
— | — | @@ -267,8 +267,8 @@ |
268 | 268 | if ( isset( $langNames[$row->iw_prefix] ) ) { |
269 | 269 | $val['language'] = $langNames[$row->iw_prefix]; |
270 | 270 | } |
271 | | - $val['url'] = wfExpandUrl( $row->iw_url ); |
272 | | - |
| 271 | + $val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT ); |
| 272 | + |
273 | 273 | $data[] = $val; |
274 | 274 | } |
275 | 275 | |
— | — | @@ -427,7 +427,7 @@ |
428 | 428 | protected function appendRightsInfo( $property ) { |
429 | 429 | global $wgRightsPage, $wgRightsUrl, $wgRightsText; |
430 | 430 | $title = Title::newFromText( $wgRightsPage ); |
431 | | - $url = $title ? wfExpandUrl( $title->getFullURL() ) : $wgRightsUrl; |
| 431 | + $url = $title ? wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ) : $wgRightsUrl; |
432 | 432 | $text = $wgRightsText; |
433 | 433 | if ( !$text && $title ) { |
434 | 434 | $text = $title->getPrefixedText(); |
Index: branches/wmf/1.17wmf1/includes/api/ApiParse.php |
— | — | @@ -349,7 +349,7 @@ |
350 | 350 | |
351 | 351 | $entry['lang'] = $bits[0]; |
352 | 352 | if ( $title ) { |
353 | | - $entry['url'] = wfExpandUrl( $title->getFullURL() ); |
| 353 | + $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ); |
354 | 354 | } |
355 | 355 | $this->getResult()->setContent( $entry, $bits[1] ); |
356 | 356 | $result[] = $entry; |
— | — | @@ -407,7 +407,7 @@ |
408 | 408 | |
409 | 409 | $title = Title::newFromText( "{$prefix}:{$title}" ); |
410 | 410 | if ( $title ) { |
411 | | - $entry['url'] = wfExpandUrl( $title->getFullURL() ); |
| 411 | + $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ); |
412 | 412 | } |
413 | 413 | |
414 | 414 | $this->getResult()->setContent( $entry, $title->getFullText() ); |
Property changes on: branches/wmf/1.17wmf1/includes/api/ApiParse.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
415 | 415 | Merged /trunk/phase3/includes/api/ApiParse.php:r94990,94996,95010-95011,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/api/ApiQueryIWLinks.php |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | if ( !is_null( $params['url'] ) ) { |
98 | 98 | $title = Title::newFromText( "{$row->iwl_prefix}:{$row->iwl_title}" ); |
99 | 99 | if ( $title ) { |
100 | | - $entry['url'] = wfExpandUrl( $title->getFullURL() ); |
| 100 | + $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ); |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
Index: branches/wmf/1.17wmf1/includes/api/ApiQueryLangLinks.php |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | if ( $params['url'] ) { |
92 | 92 | $title = Title::newFromText( "{$row->ll_lang}:{$row->ll_title}" ); |
93 | 93 | if ( $title ) { |
94 | | - $entry['url'] = wfExpandUrl( $title->getFullURL() ); |
| 94 | + $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ); |
95 | 95 | } |
96 | 96 | } |
97 | 97 | ApiResult::setContent( $entry, $row->ll_title ); |
Index: branches/wmf/1.17wmf1/includes/api/ApiQueryImageInfo.php |
— | — | @@ -286,7 +286,7 @@ |
287 | 287 | if ( !is_null( $scale ) && !$file->isOld() ) { |
288 | 288 | $mto = $file->transform( array( 'width' => $scale['width'], 'height' => $scale['height'] ) ); |
289 | 289 | if ( $mto && !$mto->isError() ) { |
290 | | - $vals['thumburl'] = wfExpandUrl( $mto->getUrl() ); |
| 290 | + $vals['thumburl'] = wfExpandUrl( $mto->getUrl(), PROTO_CURRENT ); |
291 | 291 | |
292 | 292 | // bug 23834 - If the URL's are the same, we haven't resized it, so shouldn't give the wanted |
293 | 293 | // thumbnail sizes for the thumbnail actual size |
— | — | @@ -308,8 +308,8 @@ |
309 | 309 | $vals['thumberror'] = $mto->toText(); |
310 | 310 | } |
311 | 311 | } |
312 | | - $vals['url'] = wfExpandUrl( $file->getFullURL() ); |
313 | | - $vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl() ); |
| 312 | + $vals['url'] = wfExpandUrl( $file->getFullURL(), PROTO_CURRENT ); |
| 313 | + $vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl(), PROTO_CURRENT ); |
314 | 314 | } |
315 | 315 | |
316 | 316 | if ( $sha1 ) { |
Property changes on: branches/wmf/1.17wmf1/includes/api/ApiQueryImageInfo.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
317 | 317 | Merged /trunk/phase3/includes/api/ApiQueryImageInfo.php:r94990,94996,95010-95011,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/api/ApiRsd.php |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | $apis = array( |
99 | 99 | 'MediaWiki' => array( |
100 | 100 | // The API link is required for all RSD API entries. |
101 | | - 'apiLink' => wfExpandUrl( wfScript( 'api' ) ), |
| 101 | + 'apiLink' => wfExpandUrl( wfScript( 'api' ), PROTO_CURRENT ), |
102 | 102 | |
103 | 103 | // Docs link is optional, but recommended. |
104 | 104 | 'docs' => 'http://mediawiki.org/wiki/API', |
Index: branches/wmf/1.17wmf1/includes/api/ApiQueryInfo.php |
— | — | @@ -353,8 +353,8 @@ |
354 | 354 | } |
355 | 355 | |
356 | 356 | if ( $this->fld_url ) { |
357 | | - $pageInfo['fullurl'] = wfExpandUrl( $title->getFullURL() ); |
358 | | - $pageInfo['editurl'] = wfExpandUrl( $title->getFullURL( 'action=edit' ) ); |
| 357 | + $pageInfo['fullurl'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ); |
| 358 | + $pageInfo['editurl'] = wfExpandUrl( $title->getFullURL( 'action=edit' ), PROTO_CURRENT ); |
359 | 359 | } |
360 | 360 | if ( $this->fld_readable && $title->userCanRead() ) { |
361 | 361 | $pageInfo['readable'] = ''; |
Index: branches/wmf/1.17wmf1/includes/WebRequest.php |
— | — | @@ -551,15 +551,17 @@ |
552 | 552 | } |
553 | 553 | |
554 | 554 | /** |
555 | | - * Return the request URI with the canonical service and hostname. |
| 555 | + * Return the request URI with the canonical service and hostname, path, |
| 556 | + * and query string. This will be suitable for use as an absolute link |
| 557 | + * in HTML or other output. |
556 | 558 | * |
557 | | - * NOTE: This will output a protocol-relative URL if $wgServer is protocol-relative |
| 559 | + * If $wgServer is protocol-relative, this will return a fully |
| 560 | + * qualified URL with the protocol that was used for this request. |
558 | 561 | * |
559 | 562 | * @return String |
560 | 563 | */ |
561 | 564 | public function getFullRequestURL() { |
562 | | - global $wgServer; |
563 | | - return $wgServer . $this->getRequestURL(); |
| 565 | + return wfExpandUrl( $this->getRequestURL(), PROTO_CURRENT ); |
564 | 566 | } |
565 | 567 | |
566 | 568 | /** |
Property changes on: branches/wmf/1.17wmf1/includes/WebRequest.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
567 | 569 | Merged /trunk/phase3/includes/WebRequest.php:r94990,94996 |
Index: branches/wmf/1.17wmf1/includes/Wiki.php |
— | — | @@ -216,7 +216,7 @@ |
217 | 217 | $title = SpecialPage::getTitleFor( $name, $subpage ); |
218 | 218 | } |
219 | 219 | } |
220 | | - $targetUrl = $title->getFullURL(); |
| 220 | + $targetUrl = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ); |
221 | 221 | // Redirect to canonical url, make it a 301 to allow caching |
222 | 222 | if( $targetUrl == $request->getFullRequestURL() ) { |
223 | 223 | $message = "Redirect loop detected!\n\n" . |
Property changes on: branches/wmf/1.17wmf1/includes/Wiki.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
224 | 224 | Merged /trunk/phase3/includes/Wiki.php:r94990,94996 |
Index: branches/wmf/1.17wmf1/includes/Title.php |
— | — | @@ -974,11 +974,22 @@ |
975 | 975 | public function escapeFullURL( $query = '' ) { |
976 | 976 | return htmlspecialchars( $this->getFullURL( $query ) ); |
977 | 977 | } |
| 978 | + |
| 979 | + /** |
| 980 | + * HTML-escaped version of getCanonicalURL() |
| 981 | + */ |
| 982 | + public function escapeCanonicalURL( $query = '', $variant = false ) { |
| 983 | + return htmlspecialchars( $this->getCanonicalURL( $query, $variant ) ); |
| 984 | + } |
978 | 985 | |
979 | 986 | /** |
980 | 987 | * Get the URL form for an internal link. |
981 | 988 | * - Used in various Squid-related code, in case we have a different |
982 | 989 | * internal hostname for the server from the exposed one. |
| 990 | + * |
| 991 | + * This uses $wgInternalServer to qualify the path, or $wgServer |
| 992 | + * if $wgInternalServer is not set. If the server variable used is |
| 993 | + * protocol-relative, the URL will be expanded to http:// |
983 | 994 | * |
984 | 995 | * @param $query \type{\string} an optional query string |
985 | 996 | * @param $variant \type{\string} language variant of url (for sr, zh..) |
— | — | @@ -987,12 +998,28 @@ |
988 | 999 | public function getInternalURL( $query = '', $variant = false ) { |
989 | 1000 | global $wgInternalServer, $wgServer; |
990 | 1001 | $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer; |
991 | | - $url = $server . $this->getLocalURL( $query, $variant ); |
| 1002 | + $url = wfExpandUrl( $server . $this->getLocalURL( $query, $variant ), PROTO_HTTP ); |
992 | 1003 | wfRunHooks( 'GetInternalURL', array( &$this, &$url, $query ) ); |
993 | 1004 | return $url; |
994 | 1005 | } |
995 | 1006 | |
996 | 1007 | /** |
| 1008 | + * Get the URL for a canonical link, for use in things like IRC and |
| 1009 | + * e-mail notifications. Uses $wgCanonicalServer and the |
| 1010 | + * GetCanonicalURL hook. |
| 1011 | + * |
| 1012 | + * @param $query string An optional query string |
| 1013 | + * @param $variant string Language variant of URL (for sr, zh, ...) |
| 1014 | + * @return string The URL |
| 1015 | + */ |
| 1016 | + public function getCanonicalURL( $query = '', $variant = false ) { |
| 1017 | + global $wgCanonicalServer; |
| 1018 | + $url = $wgCanonicalServer . $this->getLocalURL( $query, $variant ); |
| 1019 | + wfRunHooks( 'GetCanonicalURL', array( &$this, &$url, $query ) ); |
| 1020 | + return $url; |
| 1021 | + } |
| 1022 | + |
| 1023 | + /** |
997 | 1024 | * Get the edit URL for this Title |
998 | 1025 | * |
999 | 1026 | * @return \type{\string} the URL, or a null string if this is an |
Property changes on: branches/wmf/1.17wmf1/includes/Title.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
1000 | 1027 | Merged /trunk/phase3/includes/Title.php:r93847,94990,94995-94996,95000-95002,95007,95010-95011,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/FileDeleteForm.php |
— | — | @@ -260,7 +260,7 @@ |
261 | 261 | $this->title->getText(), |
262 | 262 | $wgLang->date( $this->getTimestamp(), true ), |
263 | 263 | $wgLang->time( $this->getTimestamp(), true ), |
264 | | - wfExpandUrl( $this->file->getArchiveUrl( $this->oldimage ) ) ); |
| 264 | + wfExpandUrl( $this->file->getArchiveUrl( $this->oldimage ), PROTO_CURRENT ) ); |
265 | 265 | } else { |
266 | 266 | return wfMsgExt( |
267 | 267 | $message, |
Index: branches/wmf/1.17wmf1/includes/DefaultSettings.php |
— | — | @@ -77,6 +77,15 @@ |
78 | 78 | |
79 | 79 | $wgServer .= ":" . $_SERVER['SERVER_PORT']; |
80 | 80 | } |
| 81 | + |
| 82 | +/** |
| 83 | + * Canonical URL of the server, to use in IRC feeds and notification e-mails. |
| 84 | + * Must be fully qualified, even if $wgServer is protocol-relative. |
| 85 | + * |
| 86 | + * Defaults to $wgServer, expanded to a fully qualified http:// URL if needed. |
| 87 | + */ |
| 88 | +$wgCanonicalServer = false; |
| 89 | + |
81 | 90 | /** @endcond */ |
82 | 91 | |
83 | 92 | /************************************************************************//** |
— | — | @@ -1745,9 +1754,9 @@ |
1746 | 1755 | $wgUseXVO = false; |
1747 | 1756 | |
1748 | 1757 | /** Add X-Forwarded-Proto to the Vary and X-Vary-Options headers for API |
1749 | | - * requests. Use this if you have an SSL termination setup and want to split |
1750 | | - * the cache between HTTP and HTTPS for API requests. This does not affect |
1751 | | - * 'regular' requests. |
| 1758 | + * requests and RSS/Atom feeds. Use this if you have an SSL termination setup |
| 1759 | + * and need to split the cache between HTTP and HTTPS for API and feed requests |
| 1760 | + * in order to prevent cache pollution. This does not affect 'normal' requests. |
1752 | 1761 | */ |
1753 | 1762 | $wgVaryOnXFPForAPI = false; |
1754 | 1763 | |
Property changes on: branches/wmf/1.17wmf1/includes/DefaultSettings.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
1755 | 1764 | Merged /trunk/phase3/includes/DefaultSettings.php:r93847,94990,94995-94996,95000-95002,95007,95010-95011,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/HttpFunctions.php |
— | — | @@ -361,7 +361,7 @@ |
362 | 362 | } |
363 | 363 | |
364 | 364 | if ( is_object( $wgTitle ) && !isset( $this->reqHeaders['Referer'] ) ) { |
365 | | - $this->setReferer( $wgTitle->getFullURL() ); |
| 365 | + $this->setReferer( wfExpandUrl( $wgTitle->getFullURL(), PROTO_CURRENT ) ); |
366 | 366 | } |
367 | 367 | |
368 | 368 | if ( !$this->noProxy ) { |
Index: branches/wmf/1.17wmf1/includes/specials/SpecialSearch.php |
— | — | @@ -706,13 +706,13 @@ |
707 | 707 | $out = ""; |
708 | 708 | // display project name |
709 | 709 | if(is_null($lastInterwiki) || $lastInterwiki != $t->getInterwiki()) { |
710 | | - if( key_exists($t->getInterwiki(),$customCaptions) ) |
| 710 | + if( array_key_exists($t->getInterwiki(),$customCaptions) ) |
711 | 711 | // captions from 'search-interwiki-custom' |
712 | 712 | $caption = $customCaptions[$t->getInterwiki()]; |
713 | 713 | else{ |
714 | 714 | // default is to show the hostname of the other wiki which might suck |
715 | 715 | // if there are many wikis on one hostname |
716 | | - $parsed = parse_url($t->getFullURL()); |
| 716 | + $parsed = wfParseUrl( $t->getFullURL() ); |
717 | 717 | $caption = wfMsg('search-interwiki-default', $parsed['host']); |
718 | 718 | } |
719 | 719 | // "more results" link (special page stuff could be localized, but we might not know target lang) |
Property changes on: branches/wmf/1.17wmf1/includes/specials/SpecialSearch.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
720 | 720 | Merged /trunk/phase3/includes/specials/SpecialSearch.php:r94990,94996,95011,95016-95017 |
Index: branches/wmf/1.17wmf1/includes/Skin.php |
— | — | @@ -224,7 +224,7 @@ |
225 | 225 | $out->addLink( array( |
226 | 226 | 'rel' => 'EditURI', |
227 | 227 | 'type' => 'application/rsd+xml', |
228 | | - 'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ) ), |
| 228 | + 'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ), PROTO_RELATIVE ), |
229 | 229 | ) ); |
230 | 230 | } |
231 | 231 | |
Property changes on: branches/wmf/1.17wmf1/includes/Skin.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
232 | 232 | Merged /trunk/phase3/includes/Skin.php:r94990,94996 |
Index: branches/wmf/1.17wmf1/opensearch_desc.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | 'height' => 16, |
53 | 53 | 'width' => 16, |
54 | 54 | 'type' => 'image/x-icon' ), |
55 | | - wfExpandUrl( $wgFavicon ) ); |
| 55 | + wfExpandUrl( $wgFavicon , PROTO_CURRENT ) ); |
56 | 56 | |
57 | 57 | $urls = array(); |
58 | 58 | |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | $urls[] = array( |
64 | 64 | 'type' => 'text/html', |
65 | 65 | 'method' => 'get', |
66 | | - 'template' => $searchPage->getFullURL( 'search={searchTerms}' ) ); |
| 66 | + 'template' => $searchPage->getCanonicalURL( 'search={searchTerms}' ) ); |
67 | 67 | |
68 | 68 | if( $wgEnableAPI ) { |
69 | 69 | // JSON interface for search suggestions. |
— | — | @@ -86,6 +86,6 @@ |
87 | 87 | // sends you to the domain root if you hit "enter" with an empty |
88 | 88 | // search box. |
89 | 89 | print Xml::element( 'moz:SearchForm', null, |
90 | | - $searchPage->getFullUrl() ); |
| 90 | + $searchPage->getCanonicalURL() ); |
91 | 91 | |
92 | 92 | print '</OpenSearchDescription>'; |
Index: branches/wmf/1.17wmf1/languages/messages/MessagesEn.php |
— | — | @@ -319,6 +319,8 @@ |
320 | 320 | 'plural' => array( 0, 'PLURAL:' ), |
321 | 321 | 'fullurl' => array( 0, 'FULLURL:' ), |
322 | 322 | 'fullurle' => array( 0, 'FULLURLE:' ), |
| 323 | + 'canonicalurl' => array( 0, 'CANONICALURL:' ), |
| 324 | + 'canonicalurle' => array( 0, 'CANONICALURLE:' ), |
323 | 325 | 'lcfirst' => array( 0, 'LCFIRST:' ), |
324 | 326 | 'ucfirst' => array( 0, 'UCFIRST:' ), |
325 | 327 | 'lc' => array( 0, 'LC:' ), |
— | — | @@ -2709,16 +2711,16 @@ |
2710 | 2712 | |
2711 | 2713 | -- |
2712 | 2714 | To change your email notification settings, visit |
2713 | | -{{fullurl:{{#special:Preferences}}}} |
| 2715 | +{{canonicalurl:{{#special:Preferences}}}} |
2714 | 2716 | |
2715 | 2717 | To change your watchlist settings, visit |
2716 | | -{{fullurl:{{#special:Watchlist}}/edit}} |
| 2718 | +{{canonicalurl:{{#special:Watchlist}}/edit}} |
2717 | 2719 | |
2718 | 2720 | To delete the page from your watchlist, visit |
2719 | 2721 | $UNWATCHURL |
2720 | 2722 | |
2721 | 2723 | Feedback and further assistance: |
2722 | | -{{fullurl:{{MediaWiki:Helppage}}}}', |
| 2724 | +{{canonicalurl:{{MediaWiki:Helppage}}}}', |
2723 | 2725 | |
2724 | 2726 | # Delete |
2725 | 2727 | 'deletepage' => 'Delete page', |
Property changes on: branches/wmf/1.17wmf1/languages/messages/MessagesEn.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
2726 | 2728 | Merged /trunk/phase3/languages/messages/MessagesEn.php:r94995-94996,95000-95002,95007,95017 |