Index: trunk/phase3/includes/Linker.php |
— | — | @@ -666,26 +666,39 @@ |
667 | 667 | * @return string |
668 | 668 | */ |
669 | 669 | public function makeBrokenImageLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '', $time = false ) { |
670 | | - global $wgEnableUploads; |
| 670 | + global $wgEnableUploads, $wgUploadNavigationUrl; |
671 | 671 | if( $title instanceof Title ) { |
672 | 672 | wfProfileIn( __METHOD__ ); |
673 | 673 | $currentExists = $time ? ( wfFindFile( $title ) != false ) : false; |
674 | | - if( $wgEnableUploads && !$currentExists ) { |
675 | | - $upload = SpecialPage::getTitleFor( 'Upload' ); |
| 674 | + if( ( $wgUploadNavigationUrl || $wgEnableUploads ) && !$currentExists ) { |
676 | 675 | if( $text == '' ) |
677 | 676 | $text = htmlspecialchars( $title->getPrefixedText() ); |
| 677 | + |
678 | 678 | $redir = RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title ); |
679 | 679 | if( $redir ) { |
| 680 | + wfProfileOut( __METHOD__ ); |
680 | 681 | return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix ); |
681 | 682 | } |
| 683 | + |
682 | 684 | $q = 'wpDestFile=' . $title->getPartialUrl(); |
683 | 685 | if( $query != '' ) |
684 | 686 | $q .= '&' . $query; |
| 687 | + |
| 688 | + if( $wgUploadNavigationUrl ) { |
| 689 | + $href = wfAppendQuery( $wgUploadNavigationUrl, $q ); |
| 690 | + } else { |
| 691 | + $upload = SpecialPage::getTitleFor( 'Upload' ); |
| 692 | + $href = $upload->getLocalUrl( $q ); |
| 693 | + } |
| 694 | + |
685 | 695 | list( $inside, $trail ) = self::splitTrail( $trail ); |
686 | | - $style = $this->getInternalLinkAttributesObj( $title, $text, 'new' ); |
| 696 | + |
687 | 697 | wfProfileOut( __METHOD__ ); |
688 | | - return '<a href="' . $upload->escapeLocalUrl( $q ) . '"' |
689 | | - . $style . '>' . $prefix . $text . $inside . '</a>' . $trail; |
| 698 | + return Html::element( 'a', array( |
| 699 | + 'href' => $href, |
| 700 | + 'class' => 'new', |
| 701 | + 'title' => $title->getPrefixedText() |
| 702 | + ), $prefix . $text . $inside ) . $trail; |
690 | 703 | } else { |
691 | 704 | wfProfileOut( __METHOD__ ); |
692 | 705 | return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix ); |
— | — | @@ -716,9 +729,7 @@ |
717 | 730 | $url = $img->getURL(); |
718 | 731 | $class = 'internal'; |
719 | 732 | } else { |
720 | | - $upload = SpecialPage::getTitleFor( 'Upload' ); |
721 | | - $url = $upload->getLocalUrl( 'wpDestFile=' . urlencode( $title->getDBkey() ) ); |
722 | | - $class = 'new'; |
| 733 | + return $this->makeBrokenImageLinkObj( $title, $text, '', '', '', '', $time==true ); |
723 | 734 | } |
724 | 735 | $alt = htmlspecialchars( $title->getText() ); |
725 | 736 | if( $text == '' ) { |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -472,6 +472,9 @@ |
473 | 473 | * Useful if you want to use a shared repository by default |
474 | 474 | * without disabling local uploads (use $wgEnableUploads = false for that) |
475 | 475 | * e.g. $wgUploadNavigationUrl = 'http://commons.wikimedia.org/wiki/Special:Upload'; |
| 476 | + * |
| 477 | + * This also affects images inline images that do not exist. In that case the URL will get |
| 478 | + * (?|&)wpDestFile=<filename> appended to it as appropriate. |
476 | 479 | */ |
477 | 480 | $wgUploadNavigationUrl = false; |
478 | 481 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -81,7 +81,10 @@ |
82 | 82 | similarly to the category namespace. |
83 | 83 | * $wgEnableSorbs renamed to $wgDnsBlacklistUrls ($wgEnableSorbs kept for |
84 | 84 | backward compatibility) |
85 | | - |
| 85 | +* $wgUploadNavigationUrl now also affects images inline images that do not |
| 86 | + exist. In that case the URL will get (?|&)wpDestFile=<filename> appended to |
| 87 | + it as appropriate. |
| 88 | + |
86 | 89 | === New features in 1.16 === |
87 | 90 | |
88 | 91 | * Add CSS defintion of the 'wikitable' class to shared.css |
— | — | @@ -279,6 +282,7 @@ |
280 | 283 | * (bug 21826) Subsections of Special:Version now also have anchors |
281 | 284 | * (bug 19791) Add URL of file source as comment to thumbs (for ImageMagick) |
282 | 285 | * (bug 21946) Sorted wikitables do not properly handle minus signs |
| 286 | +* (bug 18885) Red links for media files do not support shared repositories |
283 | 287 | |
284 | 288 | === Bug fixes in 1.16 === |
285 | 289 | |