dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
244ae86
)
Added UserCache::getUserName() convenience function.
author
Aaron Schulz
<aschulz@wikimedia.org>
Mon, 18 Mar 2013 22:03:43 +0000
(15:03 -0700)
committer
Aaron Schulz
<aschulz@wikimedia.org>
Mon, 18 Mar 2013 22:03:49 +0000
(15:03 -0700)
Change-Id: Ice6b5e8608927db588edb1e8458f7d74e53f1214
includes/cache/UserCache.php
patch
|
blob
|
history
diff --git
a/includes/cache/UserCache.php
b/includes/cache/UserCache.php
index
bfbacfa
..
694c1a1
100644
(file)
--- 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.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