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

Revision: 88164
Author:   platonides
Date:     2011-05-15 12:34:00 +0000 (Sun, 15 May 2011)
Log Message:
-----------
Perform an early exit

Modified Paths:
--------------
    trunk/phase3/includes/Linker.php

Modified: trunk/phase3/includes/Linker.php
===================================================================
--- trunk/phase3/includes/Linker.php    2011-05-15 12:32:53 UTC (rev 88163)
+++ trunk/phase3/includes/Linker.php    2011-05-15 12:34:00 UTC (rev 88164)
@@ -760,34 +760,33 @@
         */
        public static function makeBrokenImageLinkObj( $title, $text = '', 
$query = '', $trail = '', $prefix = '', $time = false ) {
                global $wgEnableUploads, $wgUploadMissingFileUrl;
-               if ( $title instanceof Title ) {
-                       wfProfileIn( __METHOD__ );
-                       $currentExists = $time ? ( wfFindFile( $title ) != 
false ) : false;
+               if ( ! $title instanceof Title ) {
+                       return "<!-- ERROR -->{$prefix}{$text}{$trail}";
+               }
+               wfProfileIn( __METHOD__ );
+               $currentExists = $time ? ( wfFindFile( $title ) != false ) : 
false;
 
-                       list( $inside, $trail ) = self::splitTrail( $trail );
-                       if ( $text == '' )
-                               $text = htmlspecialchars( 
$title->getPrefixedText() );
+               list( $inside, $trail ) = self::splitTrail( $trail );
+               if ( $text == '' )
+                       $text = htmlspecialchars( $title->getPrefixedText() );
 
-                       if ( ( $wgUploadMissingFileUrl || $wgEnableUploads ) && 
!$currentExists ) {
-                               $redir = 
RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title );
+               if ( ( $wgUploadMissingFileUrl || $wgEnableUploads ) && 
!$currentExists ) {
+                       $redir = 
RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title );
 
-                               if ( $redir ) {
-                                       wfProfileOut( __METHOD__ );
-                                       return self::linkKnown( $title, 
"$prefix$text$inside", array(), $query ) . $trail;
-                               }
-
-                               $href = self::getUploadUrl( $title, $query );
-
+                       if ( $redir ) {
                                wfProfileOut( __METHOD__ );
-                               return '<a href="' . htmlspecialchars( $href ) 
. '" class="new" title="' .
-                                       htmlspecialchars( 
$title->getPrefixedText(), ENT_QUOTES ) . '">' .
-                                       "$prefix$text$inside</a>$trail";
-                       } else {
-                               wfProfileOut( __METHOD__ );
                                return self::linkKnown( $title, 
"$prefix$text$inside", array(), $query ) . $trail;
                        }
+
+                       $href = self::getUploadUrl( $title, $query );
+
+                       wfProfileOut( __METHOD__ );
+                       return '<a href="' . htmlspecialchars( $href ) . '" 
class="new" title="' .
+                               htmlspecialchars( $title->getPrefixedText(), 
ENT_QUOTES ) . '">' .
+                               "$prefix$text$inside</a>$trail";
                } else {
-                       return "<!-- ERROR -->{$prefix}{$text}{$trail}";
+                       wfProfileOut( __METHOD__ );
+                       return self::linkKnown( $title, "$prefix$text$inside", 
array(), $query ) . $trail;
                }
        }
 


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

Reply via email to