* Introduce File::getCanonicalUrl()
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 15:27:49 +0000 (15:27 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 15:27:49 +0000 (15:27 +0000)
* 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
includes/filerepo/File.php

index 8a3d7df..5242df3 100644 (file)
@@ -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" .
index d03016f..2ca0977 100644 (file)
@@ -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 );
        }
 
        /**