mirror of
https://github.com/friendica/friendica
synced 2025-04-27 11:50:11 +00:00
Merge pull request #9019 from annando/performance
Some performance tweaks
This commit is contained in:
commit
a7f8604d42
5 changed files with 13 additions and 8 deletions
|
@ -97,6 +97,8 @@ class User
|
|||
* @}
|
||||
*/
|
||||
|
||||
private static $owner;
|
||||
|
||||
/**
|
||||
* Returns true if a user record exists with the provided id
|
||||
*
|
||||
|
@ -211,8 +213,12 @@ class User
|
|||
* @return boolean|array
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getOwnerDataById($uid, $check_valid = true)
|
||||
public static function getOwnerDataById(int $uid, bool $check_valid = true)
|
||||
{
|
||||
if (!empty(self::$owner[$uid])) {
|
||||
return self::$owner[$uid];
|
||||
}
|
||||
|
||||
$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[$uid] = $owner;
|
||||
return $owner;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue