From 586be1e1eb45a76d5992dc2a9b707e91d92bf4f5 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 9 Jan 2010 15:23:27 +0000 Subject: [PATCH] * (bug 9794) User rights log entries for foreign user now links to the foreign user's page if possible --- RELEASE-NOTES | 2 ++ includes/LogPage.php | 9 ++++++++- includes/WikiMap.php | 16 ++++++++++------ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 349a4a10c0..4fb568c4f6 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/LogPage.php b/includes/LogPage.php index 8b1cb54660..229b3d8770 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -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': diff --git a/includes/WikiMap.php b/includes/WikiMap.php index 6b6147be69..307916e184 100644 --- a/includes/WikiMap.php +++ b/includes/WikiMap.php @@ -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 ) { -- 2.20.1