summaryrefslogtreecommitdiff
path: root/includes/cache/UserCache.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/cache/UserCache.php')
-rw-r--r--includes/cache/UserCache.php13
1 files changed, 13 insertions, 0 deletions
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
@@ -59,6 +59,17 @@ class UserCache {
}
/**
+ * 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
* @param array $options Option flags; include 'userpage' and 'usertalk'
@@ -70,6 +81,8 @@ class UserCache {
$usersToCheck = array();
$usersToQuery = array();
+ $userIds = array_unique( $userIds );
+
foreach ( $userIds as $userId ) {
$userId = (int)$userId;
if ( $userId <= 0 ) {