r69997 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69996‎ | r69997 | r69998 >
Date:10:31, 27 July 2010
Author:btongminh
Status:ok (Comments)
Tags:
Comment:
Fixes for (bug 18885), r60593, r60979: The upload link for missing files can now be set separately from the navigation link with $wgUploadMissingFileUrl.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -684,11 +684,11 @@
685685 * @return String
686686 */
687687 public function makeBrokenImageLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '', $time = false ) {
688 - global $wgEnableUploads, $wgUploadNavigationUrl;
 688+ global $wgEnableUploads, $wgUploadMissingFileUrl;
689689 if( $title instanceof Title ) {
690690 wfProfileIn( __METHOD__ );
691691 $currentExists = $time ? ( wfFindFile( $title ) != false ) : false;
692 - if( ( $wgUploadNavigationUrl || $wgEnableUploads ) && !$currentExists ) {
 692+ if( ( $wgUploadMissingFileUrl || $wgEnableUploads ) && !$currentExists ) {
693693 if( $text == '' )
694694 $text = htmlspecialchars( $title->getPrefixedText() );
695695
@@ -724,13 +724,13 @@
725725 * @return String: urlencoded URL
726726 */
727727 protected function getUploadUrl( $destFile, $query = '' ) {
728 - global $wgUploadNavigationUrl;
 728+ global $wgUploadMissingFileUrl;
729729 $q = 'wpDestFile=' . $destFile->getPartialUrl();
730730 if( $query != '' )
731731 $q .= '&' . $query;
732732
733 - if( $wgUploadNavigationUrl ) {
734 - return wfAppendQuery( $wgUploadNavigationUrl, $q );
 733+ if( $wgUploadMissingFileUrl ) {
 734+ return wfAppendQuery( $wgUploadMissingFileUrl, $q );
735735 } else {
736736 $upload = SpecialPage::getTitleFor( 'Upload' );
737737 return $upload->getLocalUrl( $q );
Index: trunk/phase3/includes/DefaultSettings.php
@@ -436,13 +436,17 @@
437437 * Useful if you want to use a shared repository by default
438438 * without disabling local uploads (use $wgEnableUploads = false for that)
439439 * e.g. $wgUploadNavigationUrl = 'http://commons.wikimedia.org/wiki/Special:Upload';
440 - *
441 - * This also affects images inline images that do not exist. In that case the URL will get
442 - * (?|&)wpDestFile=<filename> appended to it as appropriate.
443440 */
444441 $wgUploadNavigationUrl = false;
445442
446443 /**
 444+ * Point the upload link for missing files to an external URL, as with
 445+ * $wgUploadNavigationUrl. The URL will get (?|&)wpDestFile=<filename>
 446+ * appended to it as appropriate.
 447+ */
 448+$wgUploadMissingFileUrl = false;
 449+
 450+/**
447451 * Give a path here to use thumb.php for thumbnail generation on client request, instead of
448452 * generating them on render and outputting a static URL. This is necessary if some of your
449453 * apache servers don't have read/write access to the thumbnail path.
Index: trunk/phase3/RELEASE-NOTES
@@ -46,6 +46,8 @@
4747 uploads in.
4848 * IBM DB2 database no longer uses the db specific $wgDBport_db2 variable but the
4949 normal $wgDBport.
 50+* The upload link for missing files can now be set separately from the
 51+ navigation link with $wgUploadMissingFileUrl.
5052
5153 === New features in 1.17 ===
5254 * (bug 10183) Users can now add personal styles and scripts to all skins via

Follow-up revisions

RevisionCommit summaryAuthorDate
r92598$wgUploadNavigationUrl should be used for file redlinks if $wgUploadMissingFi...robin23:09, 19 July 2011

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
r60979Fix regression from r60593: The title attribute for links to NS_MEDIA titles ...btongminh19:43, 12 January 2010

Comments

#Comment by Simetrical (talk | contribs)   20:52, 28 July 2010

This looks like it will break existing sites that have $wgUploadNavigationUrl set. If $wgUploadNavigationUrl is set but $wgUploadMissingFileUrl is not, then $wgUploadNavigationUrl should be used as it always was, so existing config still works.

#Comment by TheDJ (talk | contribs)   21:03, 28 July 2010

Acutally, wgUploadNavigationUrl was never used for missing file situations. The introduction of it was broken, and required this alternative solution. If I understand correctly.

#Comment by Bryan (talk | contribs)   08:16, 29 July 2010

Correct. On the other hand, the broken behaviour is present in the release version of 1.16, so it might be correct to retain compatibility with 1.16.

#Comment by Bryan (talk | contribs)   19:09, 12 October 2010

After some thinking, I think that it is better to revert to 1.15 behaviour. Backwards compatibility is good, but there is no need to be backwards compatible with broken stuff. Setting new.

Status & tagging log