r60979 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60978‎ | r60979 | r60980 >
Date:19:43, 12 January 2010
Author:btongminh
Status:ok
Tags:
Comment:
Fix regression from r60593: The title attribute for links to NS_MEDIA titles no longer contains the namespace as before.

Passed 559 of 559 tests (100%)... ALL TESTS PASSED!
Modified paths:
  • /trunk/phase3/includes/Linker.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -679,18 +679,10 @@
680680 wfProfileOut( __METHOD__ );
681681 return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix );
682682 }
 683+
 684+ $href = $this->getUploadUrl( $title, $query );
683685
684 - $q = 'wpDestFile=' . $title->getPartialUrl();
685 - if( $query != '' )
686 - $q .= '&' . $query;
687686
688 - if( $wgUploadNavigationUrl ) {
689 - $href = wfAppendQuery( $wgUploadNavigationUrl, $q );
690 - } else {
691 - $upload = SpecialPage::getTitleFor( 'Upload' );
692 - $href = $upload->getLocalUrl( $q );
693 - }
694 -
695687 list( $inside, $trail ) = self::splitTrail( $trail );
696688
697689 wfProfileOut( __METHOD__ );
@@ -707,7 +699,28 @@
708700 return "<!-- ERROR -->{$prefix}{$text}{$trail}";
709701 }
710702 }
 703+
 704+ /**
 705+ * Get the URL to upload a certain file
 706+ *
 707+ * @param $destFile Title Title of the file to upload
 708+ * @param $query string Urlencoded query string to prepend
 709+ * @return string Urlencoded URL
 710+ */
 711+ protected function getUploadUrl( $destFile, $query = '' ) {
 712+ global $wgUploadNavigationUrl;
 713+ $q = 'wpDestFile=' . $destFile->getPartialUrl();
 714+ if( $query != '' )
 715+ $q .= '&' . $query;
711716
 717+ if( $wgUploadNavigationUrl ) {
 718+ return wfAppendQuery( $wgUploadNavigationUrl, $q );
 719+ } else {
 720+ $upload = SpecialPage::getTitleFor( 'Upload' );
 721+ return $upload->getLocalUrl( $q );
 722+ }
 723+ }
 724+
712725 /**
713726 * Create a direct link to a given uploaded file.
714727 *
@@ -729,7 +742,8 @@
730743 $url = $img->getURL();
731744 $class = 'internal';
732745 } else {
733 - return $this->makeBrokenImageLinkObj( $title, $text, '', '', '', '', $time==true );
 746+ $url = $this->getUploadUrl( $title );
 747+ $class = 'new';
734748 }
735749 $alt = htmlspecialchars( $title->getText() );
736750 if( $text == '' ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r69997Fixes for (bug 18885), r60593, r60979: The upload link for missing files can ...btongminh10:31, 27 July 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r60593(bug 18885) Red links for media files do not support shared repositories...btongminh22:45, 3 January 2010

Status & tagging log