Added UserCache::getUserName() convenience function.

Change-Id: Ice6b5e8608927db588edb1e8458f7d74e53f1214
This commit is contained in:
Aaron Schulz 2013-03-18 15:03:43 -07:00
parent 244ae862a7
commit ef915e37e3

View file

@ -58,6 +58,17 @@ class UserCache {
: 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.
* @param array $userIds List of user IDs