http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95007

Revision: 95007
Author:   catrope
Date:     2011-08-19 15:27:49 +0000 (Fri, 19 Aug 2011)
Log Message:
-----------
* 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

Modified Paths:
--------------
    trunk/phase3/includes/Export.php
    trunk/phase3/includes/filerepo/File.php

Modified: trunk/phase3/includes/Export.php
===================================================================
--- trunk/phase3/includes/Export.php    2011-08-19 15:25:50 UTC (rev 95006)
+++ trunk/phase3/includes/Export.php    2011-08-19 15:27:49 UTC (rev 95007)
@@ -411,7 +411,7 @@
        }
 
        function homelink() {
-               return Xml::element( 'base', array(), 
Title::newMainPage()->getFullUrl() );
+               return Xml::element( 'base', array(), 
Title::newMainPage()->getCanonicalUrl() );
        }
 
        function caseSetting() {
@@ -644,7 +644,7 @@
                        "      " . 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" .

Modified: trunk/phase3/includes/filerepo/File.php
===================================================================
--- trunk/phase3/includes/filerepo/File.php     2011-08-19 15:25:50 UTC (rev 
95006)
+++ trunk/phase3/includes/filerepo/File.php     2011-08-19 15:27:49 UTC (rev 
95007)
@@ -215,8 +215,12 @@
         * @return String
         */
        public function getFullUrl() {
-               return wfExpandUrl( $this->getUrl() );
+               return wfExpandUrl( $this->getUrl(), PROTO_RELATIVE );
        }
+       
+       public function getCanonicalUrl() {
+               return wfExpandUrl( $this->getUrl(), PROTO_CANONICAL );
+       }
 
        /**
         * @return string


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to