Some performance tweeks

This commit is contained in:
Michael Vogel 2020-08-16 13:57:56 +02:00
parent 977e4fe5d9
commit 45c12e7716
5 changed files with 12 additions and 7 deletions

View file

@ -97,6 +97,8 @@ class User
* @}
*/
private static $owner;
/**
* Returns true if a user record exists with the provided id
*
@ -213,6 +215,10 @@ class User
*/
public static function getOwnerDataById($uid, $check_valid = true)
{
if (!empty(self::$owner)) {
return self::$owner;
}
$owner = DBA::selectFirst('owner-view', [], ['uid' => $uid]);
if (!DBA::isResult($owner)) {
if (!DBA::exists('user', ['uid' => $uid]) || !$check_valid) {
@ -256,6 +262,7 @@ class User
$owner = self::getOwnerDataById($uid, false);
}
self::$owner = $owner;
return $owner;
}