From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/cache/UserCache.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'includes/cache/UserCache.php') diff --git a/includes/cache/UserCache.php b/includes/cache/UserCache.php index bfbacfaa..6085f586 100644 --- a/includes/cache/UserCache.php +++ b/includes/cache/UserCache.php @@ -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.22 + */ + 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 @@ -70,6 +81,8 @@ class UserCache { $usersToCheck = array(); $usersToQuery = array(); + $userIds = array_unique( $userIds ); + foreach ( $userIds as $userId ) { $userId = (int)$userId; if ( $userId <= 0 ) { -- cgit v1.2.3-54-g00ecf