Added UserCache::getUserName() convenience function.
Change-Id: Ice6b5e8608927db588edb1e8458f7d74e53f1214
This commit is contained in:
parent
244ae862a7
commit
ef915e37e3
1 changed files with 11 additions and 0 deletions
11
includes/cache/UserCache.php
vendored
11
includes/cache/UserCache.php
vendored
|
|
@ -58,6 +58,17 @@ class UserCache {
|
||||||
: false; // user does not exist?
|
: false; // user does not exist?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of a user or return $ip if the user ID is 0
|
||||||
|
*
|
||||||
|
* @param integer $userId
|
||||||
|
* @param string $ip
|
||||||
|
* @since 1.21
|
||||||
|
*/
|
||||||
|
public function getUserName( $userId, $ip ) {
|
||||||
|
return $userId > 0 ? $this->getProp( $userId, 'name' ) : $ip;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preloads user names for given list of users.
|
* Preloads user names for given list of users.
|
||||||
* @param array $userIds List of user IDs
|
* @param array $userIds List of user IDs
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue