r44204 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44203‎ | r44204 | r44205 >
Date:23:49, 3 December 2008
Author:brion
Status:ok
Tags:
Comment:
Revert r44185, r44186 -- "Foreign repos (API or DB) now fetch images and/or description pages if the repo wiki has a different canonical name for the File: namespace. Added 'fileNamespace' configuration item to $wgForeignFileRepos to override the local canonical name."
The canonical-canonical 'Image' namespace name should always be used here for compatibility; an extra configuration option is unnecessary and adds confusion.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/filerepo/FileRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignAPIRepo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/FileRepo.php
@@ -15,7 +15,7 @@
1616 var $thumbScriptUrl, $transformVia404;
1717 var $descBaseUrl, $scriptDirUrl, $articleUrl, $fetchDescription, $initialCapital;
1818 var $pathDisclosureProtection = 'paranoid';
19 - var $descriptionCacheExpiry, $apiThumbCacheExpiry, $hashLevels, $fileNamespace;
 19+ var $descriptionCacheExpiry, $apiThumbCacheExpiry, $hashLevels;
2020
2121 /**
2222 * Factory functions for creating new files
@@ -30,10 +30,9 @@
3131
3232 // Optional settings
3333 $this->initialCapital = true; // by default
34 - $this->fileNamespace = MWNamespace::getCanonicalName( NS_FILE ); // fallback to 'File'
3534 foreach ( array( 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription',
3635 'thumbScriptUrl', 'initialCapital', 'pathDisclosureProtection',
37 - 'descriptionCacheExpiry', 'apiThumbCacheExpiry', 'hashLevels', 'fileNamespace' ) as $var )
 36+ 'descriptionCacheExpiry', 'apiThumbCacheExpiry', 'hashLevels' ) as $var )
3837 {
3938 if ( isset( $info[$var] ) ) {
4039 $this->$var = $info[$var];
@@ -263,10 +262,10 @@
264263 if ( is_null( $this->descBaseUrl ) ) {
265264 if ( !is_null( $this->articleUrl ) ) {
266265 $this->descBaseUrl = str_replace( '$1',
267 - wfUrlencode( $this->getFileNamespace() ) . ':', $this->articleUrl );
 266+ wfUrlencode( MWNamespace::getCanonicalName( NS_FILE ) ) . ':', $this->articleUrl );
268267 } elseif ( !is_null( $this->scriptDirUrl ) ) {
269268 $this->descBaseUrl = $this->scriptDirUrl . '/index.php?title=' .
270 - wfUrlencode( $this->getFileNamespace() ) . ':';
 269+ wfUrlencode( MWNamespace::getCanonicalName( NS_FILE ) ) . ':';
271270 } else {
272271 $this->descBaseUrl = false;
273272 }
@@ -301,7 +300,7 @@
302301 function getDescriptionRenderUrl( $name ) {
303302 if ( isset( $this->scriptDirUrl ) ) {
304303 return $this->scriptDirUrl . '/index.php?title=' .
305 - wfUrlencode( $this->getFileNamespace() . ':' . $name ) .
 304+ wfUrlencode( MWNamespace::getCanonicalName( NS_FILE ) . ':' . $name ) .
306305 '&action=render';
307306 } else {
308307 $descBase = $this->getDescBaseUrl();
@@ -535,11 +534,4 @@
536535 function findBySha1( $hash ) {
537536 return array();
538537 }
539 - /**
540 - * Returns the file namespace string
541 - * @return string
542 - */
543 - function getFileNamespace() {
544 - return $this->fileNamespace;
545 - }
546538 }
Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php
@@ -94,7 +94,7 @@
9595
9696 function getImageInfo( $title, $time = false ) {
9797 return $this->queryImage( array(
98 - 'titles' => $this->getFileNamespace() . ':' . $title->getText(),
 98+ 'titles' => 'Image:' . $title->getText(),
9999 'iiprop' => 'timestamp|user|comment|url|size|sha1|metadata|mime' ) );
100100 }
101101
Index: trunk/phase3/RELEASE-NOTES
@@ -386,10 +386,6 @@
387387 * (bug 16026) 'Revision-info' and 'revision-info-current' both accept wiki
388388 markup now.
389389 * (bug 16529) Fix for search suggestions with some third-party JS libraries
390 -* Foreign repositories (API or DB) would fail to fetch images and/or description
391 - pages if the repo wiki had a different canonical name for the File: namespace.
392 - Added 'fileNamespace' configuration item to $wgForeignFileRepos to override
393 - the local canonical name 'File' with another string.
394390 * (bug 13342) importScript() generates more consistent URI encoding
395391
396392

Follow-up revisions

RevisionCommit summaryAuthorDate
r44216Followup to r44204. Hardcoding image because it should (in theory) work alway...demon01:58, 4 December 2008
r44424Follow-up to r44216/r44217 "Followup to r44204. Hardcoding image because it s...brion22:07, 10 December 2008

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r44185Foreign repos (API or DB) now fetch images and/or description pages if the re...demon19:30, 3 December 2008
r44186API: (bug 16548) list=search threw invalid errors under certain circumstancescatrope19:33, 3 December 2008

Status & tagging log