jenkins-bot has submitted this change and it was merged.

Change subject: Added UserCache::getUserName() convenience function.
......................................................................


Added UserCache::getUserName() convenience function.

Change-Id: Ice6b5e8608927db588edb1e8458f7d74e53f1214
---
M includes/cache/UserCache.php
1 file changed, 11 insertions(+), 0 deletions(-)

Approvals:
  Demon: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/cache/UserCache.php b/includes/cache/UserCache.php
index bfbacfa..694c1a1 100644
--- a/includes/cache/UserCache.php
+++ b/includes/cache/UserCache.php
@@ -59,6 +59,17 @@
        }
 
        /**
+        * 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
         * @param array $options Option flags; include 'userpage' and 'usertalk'

-- 
To view, visit https://gerrit.wikimedia.org/r/54591
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ice6b5e8608927db588edb1e8458f7d74e53f1214
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to