Make the PROTO_ parameter to wfExpandUrl() explicit in all calls. There are now no...
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 15:46:08 +0000 (15:46 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 15:46:08 +0000 (15:46 +0000)
includes/FileDeleteForm.php
includes/OutputPage.php
includes/actions/RevertAction.php
includes/api/ApiParse.php
includes/api/ApiQuery.php
includes/api/ApiQueryIWLinks.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryLangLinks.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiRsd.php

index 54c19f0..515768f 100644 (file)
@@ -256,7 +256,7 @@ class FileDeleteForm {
                                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,
index 33e4bbd..0a6af95 100644 (file)
@@ -1812,7 +1812,7 @@ class OutputPage extends ContextSource {
 
                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 @@ $templates
                        } else {
                                $tags[] = Html::element( 'link', array(
                                        'rel' => 'canonical',
-                                       'href' => wfExpandUrl( $this->getTitle()->getFullURL(), PROTO_HTTP ) )
-                               );
+                                       'href' => $this->getTitle()->getCanonicalUrl()
+                               ) );
                        }
                }
 
index 815606d..bcb8cd8 100644 (file)
@@ -96,7 +96,9 @@ class RevertFileAction extends FormAction {
                                '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 @@ class RevertFileAction extends FormAction {
                $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() );
        }
 
index 8f95d2e..d963f8c 100644 (file)
@@ -361,7 +361,7 @@ class ApiParse extends ApiBase {
 
                        $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 @@ class ApiParse extends ApiBase {
 
                                $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() );
index 696b516..5279db9 100644 (file)
@@ -374,7 +374,7 @@ class ApiQuery extends ApiBase {
                        );
                        if ( $this->iwUrl ) {
                                $title = Title::newFromText( $rawTitleStr );
-                               $item['url'] = wfExpandUrl( $title->getFullURL() );
+                               $item['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
                        }
                        $intrwValues[] = $item;
                }
index 9a18e30..569f36f 100644 (file)
@@ -112,7 +112,7 @@ class ApiQueryIWLinks extends ApiQueryBase {
                        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 );
                                }
                        }
 
index 1f91156..03e11b7 100644 (file)
@@ -348,7 +348,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                        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 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                        $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 ) {
index 5d22527..9170b73 100644 (file)
@@ -380,8 +380,8 @@ class ApiQueryInfo extends ApiQueryBase {
                }
 
                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'] = '';
index 2583790..b0880bb 100644 (file)
@@ -106,7 +106,7 @@ class ApiQueryLangLinks extends ApiQueryBase {
                        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 );
index 3c61824..4f22f53 100644 (file)
@@ -118,7 +118,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $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 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                        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 @@ class ApiQuerySiteinfo extends ApiQueryBase {
        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();
index a806c3a..3bca725 100644 (file)
@@ -48,7 +48,7 @@ class ApiRsd extends ApiBase {
                $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 @@ class ApiRsd extends ApiBase {
                $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',