r95007 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95006‎ | r95007 | r95008 >
Date:15:27, 19 August 2011
Author:catrope
Status:ok
Tags:
Comment:
* 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 (modified) (history)
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/File.php
@@ -215,8 +215,12 @@
216216 * @return String
217217 */
218218 public function getFullUrl() {
219 - return wfExpandUrl( $this->getUrl() );
 219+ return wfExpandUrl( $this->getUrl(), PROTO_RELATIVE );
220220 }
 221+
 222+ public function getCanonicalUrl() {
 223+ return wfExpandUrl( $this->getUrl(), PROTO_CANONICAL );
 224+ }
221225
222226 /**
223227 * @return string
Index: trunk/phase3/includes/Export.php
@@ -411,7 +411,7 @@
412412 }
413413
414414 function homelink() {
415 - return Xml::element( 'base', array(), Title::newMainPage()->getFullUrl() );
 415+ return Xml::element( 'base', array(), Title::newMainPage()->getCanonicalUrl() );
416416 }
417417
418418 function caseSetting() {
@@ -644,7 +644,7 @@
645645 " " . Xml::elementClean( 'comment', null, $file->getDescription() ) . "\n" .
646646 " " . Xml::element( 'filename', null, $file->getName() ) . "\n" .
647647 $archiveName .
648 - " " . Xml::element( 'src', null, $file->getFullUrl() ) . "\n" .
 648+ " " . Xml::element( 'src', null, $file->getCanonicalUrl() ) . "\n" .
649649 " " . Xml::element( 'size', null, $file->getSize() ) . "\n" .
650650 " " . Xml::element( 'sha1base36', null, $file->getSha1() ) . "\n" .
651651 " " . Xml::element( 'rel', null, $file->getRel() ) . "\n" .

Follow-up revisions

RevisionCommit summaryAuthorDate
r955051.17wmf1: Merge a truckload of HTTPS / prot rel URL fixes: r93847, r94990, r9...catrope19:32, 25 August 2011
r964751.18: MFT r94737, r94990, r95000, r95001, r95002, r95006, r95007, r95010, r95...catrope19:37, 7 September 2011

Status & tagging log