* (bug 9794) User rights log entries for foreign user now links to the foreign user...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 9 Jan 2010 15:23:27 +0000 (15:23 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 9 Jan 2010 15:23:27 +0000 (15:23 +0000)
RELEASE-NOTES
includes/LogPage.php
includes/WikiMap.php

index 349a4a1..4fb568c 100644 (file)
@@ -691,6 +691,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 20115) Special:Userlogin title says "Log in / create account" even if the
   user can't create an account
 * (bug 2658) Don't attempt to set the TZ environment variable.
+* (bug 9794) User rights log entries for foreign user now links to the foreign
+  user's page if possible
 
 == API changes in 1.16 ==
 
index 8b1cb54..229b3d8 100644 (file)
@@ -291,7 +291,7 @@ class LogPage {
        }
        
        protected static function getTitleLink( $type, $skin, $title, &$params ) {
-               global $wgLang, $wgContLang;
+               global $wgLang, $wgContLang, $wgUserrightsInterwikiDelimiter;
                if( !$skin ) {
                        return $title->getPrefixedText();
                }
@@ -327,6 +327,13 @@ class LogPage {
                                break;
                        case 'rights':
                                $text = $wgContLang->ucfirst( $title->getText() );
+                               $parts = explode( $wgUserrightsInterwikiDelimiter, $text, 2 );
+                               if ( count( $parts ) == 2 ) {
+                                       $titleLink = WikiMap::foreignUserLink( $parts[1], $parts[0],
+                                               htmlspecialchars( $title->getPrefixedText() ) );
+                                       if ( $titleLink !== false )
+                                               break;
+                               }
                                $titleLink = $skin->link( Title::makeTitle( NS_USER, $text ) );
                                break;
                        case 'merge':
index 6b6147b..307916e 100644 (file)
@@ -33,18 +33,22 @@ class WikiMap {
                return $wiki_id;
        }
        
-       static function foreignUserLink( $wiki_id, $user ) {
-               return self::makeForeignLink( $wiki_id, "User:$user" );
+       static function foreignUserLink( $wiki_id, $user, $text=null ) {
+               return self::makeForeignLink( $wiki_id, "User:$user", $text );
        }
        
        static function makeForeignLink( $wiki_id, $page, $text=null ) {
                global $wgUser;
                $sk = $wgUser->getSkin();
-               
-               if (!$text)
+
+               if ( !$text )
                        $text=$page;
-               
-               return $sk->makeExternalLink( self::getForeignURL( $wiki_id, $page ) , $text );
+
+               $url = self::getForeignURL( $wiki_id, $page );
+               if ( $url === false )
+                       return false;
+
+               return $sk->makeExternalLink( $url, $text );
        }
        
        static function getForeignURL( $wiki_id, $page ) {