X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fcache%2FUserCache.php;h=7f36f5a64f8b1781b3d0c31b0ebe5fd188dd2517;hb=1bd2974bbe8f972681717fbaa553d9099efa2f46;hp=6085f586e987253d89663d372cf0c267f77b51f5;hpb=6d0a4f463e49db7fab930f38cd9bb5a8c5c8deb4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/UserCache.php b/includes/cache/UserCache.php index 6085f586e9..7f36f5a64f 100644 --- a/includes/cache/UserCache.php +++ b/includes/cache/UserCache.php @@ -36,23 +36,26 @@ class UserCache { if ( $instance === null ) { $instance = new self(); } + return $instance; } - protected function __construct() {} + protected function __construct() { + } /** * Get a property of a user based on their user ID * - * @param $userId integer User ID + * @param int $userId User ID * @param string $prop User property - * @return mixed The property or false if the user does not exist + * @return mixed|bool The property or false if the user does not exist */ public function getProp( $userId, $prop ) { if ( !isset( $this->cache[$userId][$prop] ) ) { wfDebug( __METHOD__ . ": querying DB for prop '$prop' for user ID '$userId'.\n" ); $this->doQuery( array( $userId ) ); // cache miss } + return isset( $this->cache[$userId][$prop] ) ? $this->cache[$userId][$prop] : false; // user does not exist? @@ -61,8 +64,9 @@ class UserCache { /** * Get the name of a user or return $ip if the user ID is 0 * - * @param integer $userId + * @param int $userId * @param string $ip + * @return string * @since 1.22 */ public function getUserName( $userId, $ip ) { @@ -73,7 +77,7 @@ class UserCache { * Preloads user names for given list of users. * @param array $userIds List of user IDs * @param array $options Option flags; include 'userpage' and 'usertalk' - * @param string $caller the calling method + * @param string $caller The calling method */ public function doQuery( array $userIds, $options = array(), $caller = '' ) { wfProfileIn( __METHOD__ ); @@ -136,7 +140,7 @@ class UserCache { /** * Check if a cache type is in $options and was not loaded for this user * - * @param $uid integer user ID + * @param int $uid User ID * @param string $type Cache type * @param array $options Requested cache types * @return bool