Use the uid for the owner cache

This commit is contained in:
Michael Vogel 2020-08-16 14:51:15 +02:00
parent 45c12e7716
commit 87ac50e253

View file

@ -213,10 +213,10 @@ class User
* @return boolean|array * @return boolean|array
* @throws Exception * @throws Exception
*/ */
public static function getOwnerDataById($uid, $check_valid = true) public static function getOwnerDataById(int $uid, bool $check_valid = true)
{ {
if (!empty(self::$owner)) { if (!empty(self::$owner[$uid])) {
return self::$owner; return self::$owner[$uid];
} }
$owner = DBA::selectFirst('owner-view', [], ['uid' => $uid]); $owner = DBA::selectFirst('owner-view', [], ['uid' => $uid]);
@ -262,7 +262,7 @@ class User
$owner = self::getOwnerDataById($uid, false); $owner = self::getOwnerDataById($uid, false);
} }
self::$owner = $owner; self::$owner[$uid] = $owner;
return $owner; return $owner;
} }