* (bug 9794) User rights log entries for foreign user now links to the foreign user's page if possible

This commit is contained in:
Alexandre Emsenhuber 2010-01-09 15:23:27 +00:00
parent 4b0299a765
commit 586be1e1eb
3 changed files with 20 additions and 7 deletions

View 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 ==

View 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':

View file

@ -33,8 +33,8 @@ 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 ) {
@ -44,7 +44,11 @@ class WikiMap {
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 ) {