From c8623eae268a68d6b92d7e544047c63e62a7a042 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Tue, 27 Jul 2010 10:31:30 +0000 Subject: [PATCH] Fixes for (bug 18885), r60593, r60979: The upload link for missing files can now be set separately from the navigation link with $wgUploadMissingFileUrl. --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 10 +++++++--- includes/Linker.php | 10 +++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8476e4c9b7..6c5a36fd30 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -46,6 +46,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN uploads in. * IBM DB2 database no longer uses the db specific $wgDBport_db2 variable but the normal $wgDBport. +* The upload link for missing files can now be set separately from the + navigation link with $wgUploadMissingFileUrl. === New features in 1.17 === * (bug 10183) Users can now add personal styles and scripts to all skins via diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index ba1c7c5d16..0c5cfc2709 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -436,12 +436,16 @@ $wgMaxUploadSize = 1024*1024*100; # 100MB * Useful if you want to use a shared repository by default * without disabling local uploads (use $wgEnableUploads = false for that) * e.g. $wgUploadNavigationUrl = 'http://commons.wikimedia.org/wiki/Special:Upload'; - * - * This also affects images inline images that do not exist. In that case the URL will get - * (?|&)wpDestFile= appended to it as appropriate. */ $wgUploadNavigationUrl = false; +/** + * Point the upload link for missing files to an external URL, as with + * $wgUploadNavigationUrl. The URL will get (?|&)wpDestFile= + * appended to it as appropriate. + */ +$wgUploadMissingFileUrl = false; + /** * Give a path here to use thumb.php for thumbnail generation on client request, instead of * generating them on render and outputting a static URL. This is necessary if some of your diff --git a/includes/Linker.php b/includes/Linker.php index 008b9b8668..1a9e9cf876 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -684,11 +684,11 @@ class Linker { * @return String */ public function makeBrokenImageLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '', $time = false ) { - global $wgEnableUploads, $wgUploadNavigationUrl; + global $wgEnableUploads, $wgUploadMissingFileUrl; if( $title instanceof Title ) { wfProfileIn( __METHOD__ ); $currentExists = $time ? ( wfFindFile( $title ) != false ) : false; - if( ( $wgUploadNavigationUrl || $wgEnableUploads ) && !$currentExists ) { + if( ( $wgUploadMissingFileUrl || $wgEnableUploads ) && !$currentExists ) { if( $text == '' ) $text = htmlspecialchars( $title->getPrefixedText() ); @@ -724,13 +724,13 @@ class Linker { * @return String: urlencoded URL */ protected function getUploadUrl( $destFile, $query = '' ) { - global $wgUploadNavigationUrl; + global $wgUploadMissingFileUrl; $q = 'wpDestFile=' . $destFile->getPartialUrl(); if( $query != '' ) $q .= '&' . $query; - if( $wgUploadNavigationUrl ) { - return wfAppendQuery( $wgUploadNavigationUrl, $q ); + if( $wgUploadMissingFileUrl ) { + return wfAppendQuery( $wgUploadMissingFileUrl, $q ); } else { $upload = SpecialPage::getTitleFor( 'Upload' ); return $upload->getLocalUrl( $q ); -- 2.20.1