http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72398

Revision: 72398
Author:   platonides
Date:     2010-09-04 22:25:59 +0000 (Sat, 04 Sep 2010)

Log Message:
-----------
Remove usage of deprecated makeKnownLinkObj().
Added a parserTest for each call of the old makeKnownLinkObj (and checked that 
they pass now with linkKnown).

Modified Paths:
--------------
    trunk/phase3/includes/Linker.php
    trunk/phase3/maintenance/parserTests.inc
    trunk/phase3/maintenance/parserTests.txt

Modified: trunk/phase3/includes/Linker.php
===================================================================
--- trunk/phase3/includes/Linker.php    2010-09-04 21:44:50 UTC (rev 72397)
+++ trunk/phase3/includes/Linker.php    2010-09-04 22:25:59 UTC (rev 72398)
@@ -687,28 +687,28 @@
                if ( $title instanceof Title ) {
                        wfProfileIn( __METHOD__ );
                        $currentExists = $time ? ( wfFindFile( $title ) != 
false ) : false;
+
+                       list( $inside, $trail ) = self::splitTrail( $trail );
+                       if ( $text == '' )
+                               $text = htmlspecialchars( 
$title->getPrefixedText() );
+
                        if ( ( $wgUploadMissingFileUrl || $wgEnableUploads ) && 
!$currentExists ) {
-                               if ( $text == '' )
-                                       $text = htmlspecialchars( 
$title->getPrefixedText() );
+                               $redir = 
RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title );
 
-                               $redir = 
RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title );
                                if ( $redir ) {
                                        wfProfileOut( __METHOD__ );
-                                       return $this->makeKnownLinkObj( $title, 
$text, $query, $trail, $prefix );
+                                       return $this->linkKnown( $title, 
"$prefix$text$inside", array(), $query ) . $trail;
                                }
 
                                $href = $this->getUploadUrl( $title, $query );
 
-
-                               list( $inside, $trail ) = self::splitTrail( 
$trail );
-
                                wfProfileOut( __METHOD__ );
                                return '<a href="' . htmlspecialchars( $href ) 
. '" class="new" title="' .
                                                                
htmlspecialchars( $title->getPrefixedText(), ENT_QUOTES ) . '">' .
                                                                
htmlspecialchars( $prefix . $text . $inside, ENT_NOQUOTES ) . '</a>' . $trail;
                        } else {
                                wfProfileOut( __METHOD__ );
-                               return $this->makeKnownLinkObj( $title, $text, 
$query, $trail, $prefix );
+                               return $this->linkKnown( $title, 
"$prefix$text$inside", array(), $query ) . $trail;
                        }
                } else {
                        return "<!-- ERROR -->{$prefix}{$text}{$trail}";

Modified: trunk/phase3/maintenance/parserTests.inc
===================================================================
--- trunk/phase3/maintenance/parserTests.inc    2010-09-04 21:44:50 UTC (rev 
72397)
+++ trunk/phase3/maintenance/parserTests.inc    2010-09-04 22:25:59 UTC (rev 
72398)
@@ -545,7 +545,7 @@
                                'hashLevels' => 2,
                                'transformVia404' => false,
                        ),
-                       'wgEnableUploads' => true,
+                       'wgEnableUploads' => self::getOptionValue( 
'wgEnableUploads', $opts, true ),
                        'wgStyleSheetPath' => '/skins',
                        'wgSitename' => 'MediaWiki',
                        'wgServerName' => 'Britney-Spears',

Modified: trunk/phase3/maintenance/parserTests.txt
===================================================================
--- trunk/phase3/maintenance/parserTests.txt    2010-09-04 21:44:50 UTC (rev 
72397)
+++ trunk/phase3/maintenance/parserTests.txt    2010-09-04 22:25:59 UTC (rev 
72398)
@@ -3568,7 +3568,33 @@
 
 !! end
 
+!! article 
+File:Barfoo.jpg
+!! text
+#REDIRECT [[File:Barfoo.jpg]]
+!! endarticle
 
+!! test
+Redirected image
+!! input
+[[Image:Barfoo.jpg]]
+!! result
+<p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
+</p>
+!! end
+
+!! test
+Missing image with uploads disabled
+!! options
+wgEnableUploads=0
+!! input
+[[Image:Foobaz.jpg]]
+!! result
+<p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
+</p>
+!! end
+
+
 ###
 ### Subpages
 ###



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to