http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95010
Revision: 95010
Author: catrope
Date: 2011-08-19 15:46:08 +0000 (Fri, 19 Aug 2011)
Log Message:
-----------
Make the PROTO_ parameter to wfExpandUrl() explicit in all calls. There are now
no calls to wfExpandUrl() in core that rely on PROTO_CURRENT being the default.
Also switch to using getCanonicalUrl() for.... rel="canonical" :D (I picked the
right name, I KNEW IT)
Modified Paths:
--------------
trunk/phase3/includes/FileDeleteForm.php
trunk/phase3/includes/OutputPage.php
trunk/phase3/includes/actions/RevertAction.php
trunk/phase3/includes/api/ApiParse.php
trunk/phase3/includes/api/ApiQuery.php
trunk/phase3/includes/api/ApiQueryIWLinks.php
trunk/phase3/includes/api/ApiQueryImageInfo.php
trunk/phase3/includes/api/ApiQueryInfo.php
trunk/phase3/includes/api/ApiQueryLangLinks.php
trunk/phase3/includes/api/ApiQuerySiteinfo.php
trunk/phase3/includes/api/ApiRsd.php
Modified: trunk/phase3/includes/FileDeleteForm.php
===================================================================
--- trunk/phase3/includes/FileDeleteForm.php 2011-08-19 15:36:01 UTC (rev
95009)
+++ trunk/phase3/includes/FileDeleteForm.php 2011-08-19 15:46:08 UTC (rev
95010)
@@ -256,7 +256,7 @@
wfEscapeWikiText( $this->title->getText() ),
$wgLang->date( $this->getTimestamp(), true ),
$wgLang->time( $this->getTimestamp(), true ),
- wfExpandUrl( $this->file->getArchiveUrl(
$this->oldimage ) ) );
+ wfExpandUrl( $this->file->getArchiveUrl(
$this->oldimage ), PROTO_CURRENT ) );
} else {
return wfMsgExt(
$message,
Modified: trunk/phase3/includes/OutputPage.php
===================================================================
--- trunk/phase3/includes/OutputPage.php 2011-08-19 15:36:01 UTC (rev
95009)
+++ trunk/phase3/includes/OutputPage.php 2011-08-19 15:46:08 UTC (rev
95010)
@@ -1812,7 +1812,7 @@
if ( $this->mRedirect != '' ) {
# Standards require redirect URLs to be absolute
- $this->mRedirect = wfExpandUrl( $this->mRedirect );
+ $this->mRedirect = wfExpandUrl( $this->mRedirect,
PROTO_CURRENT );
if( $this->mRedirectCode == '301' ||
$this->mRedirectCode == '303' ) {
if( !$wgDebugRedirects ) {
$message = HttpStatus::getMessage(
$this->mRedirectCode );
@@ -2822,8 +2822,8 @@
} else {
$tags[] = Html::element( 'link', array(
'rel' => 'canonical',
- 'href' => wfExpandUrl(
$this->getTitle()->getFullURL(), PROTO_HTTP ) )
- );
+ 'href' =>
$this->getTitle()->getCanonicalUrl()
+ ) );
}
}
Modified: trunk/phase3/includes/actions/RevertAction.php
===================================================================
--- trunk/phase3/includes/actions/RevertAction.php 2011-08-19 15:36:01 UTC
(rev 95009)
+++ trunk/phase3/includes/actions/RevertAction.php 2011-08-19 15:46:08 UTC
(rev 95010)
@@ -96,7 +96,9 @@
'raw' => true,
'default' => wfMsgExt( 'filerevert-intro',
'parse', $this->getTitle()->getText(),
$this->getLang()->date( $timestamp,
true ), $this->getLang()->time( $timestamp, true ),
- wfExpandUrl(
$this->page->getFile()->getArchiveUrl( $this->getRequest()->getText( 'oldimage'
) ) ) )
+ wfExpandUrl(
$this->page->getFile()->getArchiveUrl( $this->getRequest()->getText( 'oldimage'
) ),
+ PROTO_CURRENT
+ ) )
),
'comment' => array(
'type' => 'text',
@@ -119,7 +121,9 @@
$this->getOutput()->addHTML( wfMsgExt( 'filerevert-success',
'parse', $this->getTitle()->getText(),
$this->getLang()->date( $timestamp, true ),
$this->getLang()->time( $timestamp, true ),
- wfExpandUrl( $this->page->getFile()->getArchiveUrl(
$this->getRequest()->getText( 'oldimage' ) ) ) ) );
+ wfExpandUrl( $this->page->getFile()->getArchiveUrl(
$this->getRequest()->getText( 'oldimage' ) ),
+ PROTO_CURRENT
+ ) ) );
$this->getOutput()->returnToMain( false, $this->getTitle() );
}
Modified: trunk/phase3/includes/api/ApiParse.php
===================================================================
--- trunk/phase3/includes/api/ApiParse.php 2011-08-19 15:36:01 UTC (rev
95009)
+++ trunk/phase3/includes/api/ApiParse.php 2011-08-19 15:46:08 UTC (rev
95010)
@@ -361,7 +361,7 @@
$entry['lang'] = $bits[0];
if ( $title ) {
- $entry['url'] = wfExpandUrl(
$title->getFullURL() );
+ $entry['url'] = wfExpandUrl(
$title->getFullURL(), PROTO_CURRENT );
}
$this->getResult()->setContent( $entry, $bits[1] );
$result[] = $entry;
@@ -443,7 +443,7 @@
$title = Title::newFromText(
"{$prefix}:{$title}" );
if ( $title ) {
- $entry['url'] = wfExpandUrl(
$title->getFullURL() );
+ $entry['url'] = wfExpandUrl(
$title->getFullURL(), PROTO_CURRENT );
}
$this->getResult()->setContent( $entry,
$title->getFullText() );
Modified: trunk/phase3/includes/api/ApiQuery.php
===================================================================
--- trunk/phase3/includes/api/ApiQuery.php 2011-08-19 15:36:01 UTC (rev
95009)
+++ trunk/phase3/includes/api/ApiQuery.php 2011-08-19 15:46:08 UTC (rev
95010)
@@ -374,7 +374,7 @@
);
if ( $this->iwUrl ) {
$title = Title::newFromText( $rawTitleStr );
- $item['url'] = wfExpandUrl(
$title->getFullURL() );
+ $item['url'] = wfExpandUrl(
$title->getFullURL(), PROTO_CURRENT );
}
$intrwValues[] = $item;
}
Modified: trunk/phase3/includes/api/ApiQueryIWLinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryIWLinks.php 2011-08-19 15:36:01 UTC
(rev 95009)
+++ trunk/phase3/includes/api/ApiQueryIWLinks.php 2011-08-19 15:46:08 UTC
(rev 95010)
@@ -112,7 +112,7 @@
if ( $params['url'] ) {
$title = Title::newFromText(
"{$row->iwl_prefix}:{$row->iwl_title}" );
if ( $title ) {
- $entry['url'] = wfExpandUrl(
$title->getFullURL() );
+ $entry['url'] = wfExpandUrl(
$title->getFullURL(), PROTO_CURRENT );
}
}
Modified: trunk/phase3/includes/api/ApiQueryImageInfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryImageInfo.php 2011-08-19 15:36:01 UTC
(rev 95009)
+++ trunk/phase3/includes/api/ApiQueryImageInfo.php 2011-08-19 15:46:08 UTC
(rev 95010)
@@ -348,7 +348,7 @@
if ( !is_null( $thumbParams ) ) {
$mto = $file->transform( $thumbParams );
if ( $mto && !$mto->isError() ) {
- $vals['thumburl'] = wfExpandUrl(
$mto->getUrl() );
+ $vals['thumburl'] = wfExpandUrl(
$mto->getUrl(), PROTO_CURRENT );
// bug 23834 - If the URL's are the
same, we haven't resized it, so shouldn't give the wanted
// thumbnail sizes for the thumbnail
actual size
@@ -370,8 +370,8 @@
$vals['thumberror'] = $mto->toText();
}
}
- $vals['url'] = wfExpandUrl( $file->getFullURL() );
- $vals['descriptionurl'] = wfExpandUrl(
$file->getDescriptionUrl() );
+ $vals['url'] = wfExpandUrl( $file->getFullURL(),
PROTO_CURRENT );
+ $vals['descriptionurl'] = wfExpandUrl(
$file->getDescriptionUrl(), PROTO_CURRENT );
}
if ( $sha1 ) {
Modified: trunk/phase3/includes/api/ApiQueryInfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryInfo.php 2011-08-19 15:36:01 UTC (rev
95009)
+++ trunk/phase3/includes/api/ApiQueryInfo.php 2011-08-19 15:46:08 UTC (rev
95010)
@@ -380,8 +380,8 @@
}
if ( $this->fld_url ) {
- $pageInfo['fullurl'] = wfExpandUrl(
$title->getFullURL() );
- $pageInfo['editurl'] = wfExpandUrl( $title->getFullURL(
'action=edit' ) );
+ $pageInfo['fullurl'] = wfExpandUrl(
$title->getFullURL(), PROTO_CURRENT );
+ $pageInfo['editurl'] = wfExpandUrl( $title->getFullURL(
'action=edit' ), PROTO_CURRENT );
}
if ( $this->fld_readable && $title->userCanRead() ) {
$pageInfo['readable'] = '';
Modified: trunk/phase3/includes/api/ApiQueryLangLinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryLangLinks.php 2011-08-19 15:36:01 UTC
(rev 95009)
+++ trunk/phase3/includes/api/ApiQueryLangLinks.php 2011-08-19 15:46:08 UTC
(rev 95010)
@@ -106,7 +106,7 @@
if ( $params['url'] ) {
$title = Title::newFromText(
"{$row->ll_lang}:{$row->ll_title}" );
if ( $title ) {
- $entry['url'] = wfExpandUrl(
$title->getFullURL() );
+ $entry['url'] = wfExpandUrl(
$title->getFullURL(), PROTO_CURRENT );
}
}
ApiResult::setContent( $entry, $row->ll_title );
Modified: trunk/phase3/includes/api/ApiQuerySiteinfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQuerySiteinfo.php 2011-08-19 15:36:01 UTC
(rev 95009)
+++ trunk/phase3/includes/api/ApiQuerySiteinfo.php 2011-08-19 15:46:08 UTC
(rev 95010)
@@ -118,7 +118,7 @@
$data = array();
$mainPage = Title::newMainPage();
$data['mainpage'] = $mainPage->getPrefixedText();
- $data['base'] = wfExpandUrl( $mainPage->getFullUrl() );
+ $data['base'] = wfExpandUrl( $mainPage->getFullUrl(),
PROTO_CURRENT );
$data['sitename'] = $GLOBALS['wgSitename'];
$data['generator'] = "MediaWiki {$GLOBALS['wgVersion']}";
$data['phpversion'] = phpversion();
@@ -297,7 +297,7 @@
if ( isset( $langNames[$prefix] ) ) {
$val['language'] = $langNames[$prefix];
}
- $val['url'] = wfExpandUrl( $row['iw_url'] );
+ $val['url'] = wfExpandUrl( $row['iw_url'],
PROTO_CURRENT );
if( isset( $row['iw_wikiid'] ) ) {
$val['wikiid'] = $row['iw_wikiid'];
}
@@ -465,7 +465,7 @@
protected function appendRightsInfo( $property ) {
global $wgRightsPage, $wgRightsUrl, $wgRightsText;
$title = Title::newFromText( $wgRightsPage );
- $url = $title ? wfExpandUrl( $title->getFullURL() ) :
$wgRightsUrl;
+ $url = $title ? wfExpandUrl( $title->getFullURL(),
PROTO_CURRENT ) : $wgRightsUrl;
$text = $wgRightsText;
if ( !$text && $title ) {
$text = $title->getPrefixedText();
Modified: trunk/phase3/includes/api/ApiRsd.php
===================================================================
--- trunk/phase3/includes/api/ApiRsd.php 2011-08-19 15:36:01 UTC (rev
95009)
+++ trunk/phase3/includes/api/ApiRsd.php 2011-08-19 15:46:08 UTC (rev
95010)
@@ -48,7 +48,7 @@
$service = array( 'apis' => $this->formatRsdApiList() );
ApiResult::setContent( $service, 'MediaWiki', 'engineName' );
ApiResult::setContent( $service, 'http://www.mediawiki.org/',
'engineLink' );
- ApiResult::setContent( $service, wfExpandUrl(
Title::newMainPage()->getFullURL() ), 'homePageLink' );
+ ApiResult::setContent( $service,
Title::newMainPage()->getCanonicalUrl(), 'homePageLink' );
$result->setIndexedTagName( $service['apis'], 'api' );
@@ -98,7 +98,7 @@
$apis = array(
'MediaWiki' => array(
// The API link is required for all RSD API
entries.
- 'apiLink' => wfExpandUrl( wfScript( 'api' ) ),
+ 'apiLink' => wfExpandUrl( wfScript( 'api' ),
PROTO_CURRENT ),
// Docs link is optional, but recommended.
'docs' => 'http://www.mediawiki.org/wiki/API',
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs