Index: trunk/phase3/maintenance/parserTests.inc |
— | — | @@ -545,7 +545,7 @@ |
546 | 546 | 'hashLevels' => 2, |
547 | 547 | 'transformVia404' => false, |
548 | 548 | ), |
549 | | - 'wgEnableUploads' => true, |
| 549 | + 'wgEnableUploads' => self::getOptionValue( 'wgEnableUploads', $opts, true ), |
550 | 550 | 'wgStyleSheetPath' => '/skins', |
551 | 551 | 'wgSitename' => 'MediaWiki', |
552 | 552 | 'wgServerName' => 'Britney-Spears', |
Index: trunk/phase3/maintenance/parserTests.txt |
— | — | @@ -3568,7 +3568,33 @@ |
3569 | 3569 | |
3570 | 3570 | !! end |
3571 | 3571 | |
| 3572 | +!! article |
| 3573 | +File:Barfoo.jpg |
| 3574 | +!! text |
| 3575 | +#REDIRECT [[File:Barfoo.jpg]] |
| 3576 | +!! endarticle |
3572 | 3577 | |
| 3578 | +!! test |
| 3579 | +Redirected image |
| 3580 | +!! input |
| 3581 | +[[Image:Barfoo.jpg]] |
| 3582 | +!! result |
| 3583 | +<p><a href="https://www.mediawiki.org/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a> |
| 3584 | +</p> |
| 3585 | +!! end |
| 3586 | + |
| 3587 | +!! test |
| 3588 | +Missing image with uploads disabled |
| 3589 | +!! options |
| 3590 | +wgEnableUploads=0 |
| 3591 | +!! input |
| 3592 | +[[Image:Foobaz.jpg]] |
| 3593 | +!! result |
| 3594 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a> |
| 3595 | +</p> |
| 3596 | +!! end |
| 3597 | + |
| 3598 | + |
3573 | 3599 | ### |
3574 | 3600 | ### Subpages |
3575 | 3601 | ### |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -687,28 +687,28 @@ |
688 | 688 | if ( $title instanceof Title ) { |
689 | 689 | wfProfileIn( __METHOD__ ); |
690 | 690 | $currentExists = $time ? ( wfFindFile( $title ) != false ) : false; |
| 691 | + |
| 692 | + list( $inside, $trail ) = self::splitTrail( $trail ); |
| 693 | + if ( $text == '' ) |
| 694 | + $text = htmlspecialchars( $title->getPrefixedText() ); |
| 695 | + |
691 | 696 | if ( ( $wgUploadMissingFileUrl || $wgEnableUploads ) && !$currentExists ) { |
692 | | - if ( $text == '' ) |
693 | | - $text = htmlspecialchars( $title->getPrefixedText() ); |
| 697 | + $redir = RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title ); |
694 | 698 | |
695 | | - $redir = RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title ); |
696 | 699 | if ( $redir ) { |
697 | 700 | wfProfileOut( __METHOD__ ); |
698 | | - return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix ); |
| 701 | + return $this->linkKnown( $title, "$prefix$text$inside", array(), $query ) . $trail; |
699 | 702 | } |
700 | 703 | |
701 | 704 | $href = $this->getUploadUrl( $title, $query ); |
702 | 705 | |
703 | | - |
704 | | - list( $inside, $trail ) = self::splitTrail( $trail ); |
705 | | - |
706 | 706 | wfProfileOut( __METHOD__ ); |
707 | 707 | return '<a href="' . htmlspecialchars( $href ) . '" class="new" title="' . |
708 | 708 | htmlspecialchars( $title->getPrefixedText(), ENT_QUOTES ) . '">' . |
709 | 709 | htmlspecialchars( $prefix . $text . $inside, ENT_NOQUOTES ) . '</a>' . $trail; |
710 | 710 | } else { |
711 | 711 | wfProfileOut( __METHOD__ ); |
712 | | - return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix ); |
| 712 | + return $this->linkKnown( $title, "$prefix$text$inside", array(), $query ) . $trail; |
713 | 713 | } |
714 | 714 | } else { |
715 | 715 | return "<!-- ERROR -->{$prefix}{$text}{$trail}"; |