From 56b2da7efba0cf93fe341931bfeaecb57b604a36 Mon Sep 17 00:00:00 2001 From: Robin Pepermans Date: Tue, 19 Jul 2011 23:09:55 +0000 Subject: [PATCH] $wgUploadNavigationUrl should be used for file redlinks if $wgUploadMissingFileUrl is not set. The first was used for this until the second was introduced in r69997 (1.17). According to the comments there it was broken in 1.16 but as far as I tested it worked in 1.16. In any case, the old behavior should be restored as most WMF wikis have set wgUploadNavigationUrl but not wgUploadMissingFileUrl. --- RELEASE-NOTES-1.19 | 3 +++ includes/Linker.php | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 3143769f15..5efd328487 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -17,6 +17,9 @@ production. cache is used. === Bug fixes in 1.19 === +* $wgUploadNavigationUrl should be used for file redlinks if + $wgUploadMissingFileUrl is not set. The first was used for this + until the second was introduced in 1.17. === API changes in 1.19 === * (bug 19838) siprop=interwikimap can now use the interwiki cache. diff --git a/includes/Linker.php b/includes/Linker.php index 1699db6697..3ee0aee747 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -768,7 +768,7 @@ class Linker { * @return String */ public static function makeBrokenImageLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '', $time = false ) { - global $wgEnableUploads, $wgUploadMissingFileUrl; + global $wgEnableUploads, $wgUploadMissingFileUrl, $wgUploadNavigationUrl; if ( ! $title instanceof Title ) { return "{$prefix}{$text}{$trail}"; } @@ -779,7 +779,7 @@ class Linker { if ( $text == '' ) $text = htmlspecialchars( $title->getPrefixedText() ); - if ( ( $wgUploadMissingFileUrl || $wgEnableUploads ) && !$currentExists ) { + if ( ( $wgUploadMissingFileUrl || $wgUploadNavigationUrl || $wgEnableUploads ) && !$currentExists ) { $redir = RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title ); if ( $redir ) { @@ -807,13 +807,15 @@ class Linker { * @return String: urlencoded URL */ protected static function getUploadUrl( $destFile, $query = '' ) { - global $wgUploadMissingFileUrl; + global $wgUploadMissingFileUrl, $wgUploadNavigationUrl; $q = 'wpDestFile=' . $destFile->getPartialUrl(); if ( $query != '' ) $q .= '&' . $query; if ( $wgUploadMissingFileUrl ) { return wfAppendQuery( $wgUploadMissingFileUrl, $q ); + } elseif( $wgUploadNavigationUrl ) { + return wfAppendQuery( $wgUploadNavigationUrl, $q ); } else { $upload = SpecialPage::getTitleFor( 'Upload' ); return $upload->getLocalUrl( $q ); -- 2.20.1