From 16e540e5c3e07cb09f218d9bba2da9d41714b53d Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 19 Aug 2011 15:27:49 +0000 Subject: [PATCH] * Introduce File::getCanonicalUrl() * Make File::getFullUrl() use PROTO_RELATIVE for consistency with other methods named getFullUrl() and to prevent cache pollution * Use canonical URLs in Export.php --- includes/Export.php | 4 ++-- includes/filerepo/File.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/Export.php b/includes/Export.php index 8a3d7df262..5242df3915 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -411,7 +411,7 @@ class XmlDumpWriter { } function homelink() { - return Xml::element( 'base', array(), Title::newMainPage()->getFullUrl() ); + return Xml::element( 'base', array(), Title::newMainPage()->getCanonicalUrl() ); } function caseSetting() { @@ -644,7 +644,7 @@ class XmlDumpWriter { " " . Xml::elementClean( 'comment', null, $file->getDescription() ) . "\n" . " " . Xml::element( 'filename', null, $file->getName() ) . "\n" . $archiveName . - " " . Xml::element( 'src', null, $file->getFullUrl() ) . "\n" . + " " . Xml::element( 'src', null, $file->getCanonicalUrl() ) . "\n" . " " . Xml::element( 'size', null, $file->getSize() ) . "\n" . " " . Xml::element( 'sha1base36', null, $file->getSha1() ) . "\n" . " " . Xml::element( 'rel', null, $file->getRel() ) . "\n" . diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index d03016f7b5..2ca0977940 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -215,7 +215,11 @@ abstract class File { * @return String */ public function getFullUrl() { - return wfExpandUrl( $this->getUrl() ); + return wfExpandUrl( $this->getUrl(), PROTO_RELATIVE ); + } + + public function getCanonicalUrl() { + return wfExpandUrl( $this->getUrl(), PROTO_CANONICAL ); } /** -- 2.20.1