diff options
author | Louis Chemineau <louis@chmn.me> | 2025-03-26 20:59:11 +0100 |
---|---|---|
committer | Andy Scherzinger <info@andy-scherzinger.de> | 2025-03-30 08:54:41 +0200 |
commit | 22e02d1c1e7534ab2b91d2cc3f88cb6a0f7c3495 (patch) | |
tree | a08338cd9909dacb6a41d130950b09c8a0058206 | |
parent | 275b32d5138c0221b425198a9b517f536bba0a0a (diff) | |
download | nextcloud-server-22e02d1c1e7534ab2b91d2cc3f88cb6a0f7c3495.tar.gz nextcloud-server-22e02d1c1e7534ab2b91d2cc3f88cb6a0f7c3495.zip |
chore: Refactor callForSeenUsers to use getSeenUsers
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r-- | lib/private/User/Manager.php | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index cfe2d6dad0b..152fb08eeeb 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -628,30 +628,14 @@ class Manager extends PublicEmitter implements IUserManager { return $result; } - /** - * @param \Closure $callback - * @psalm-param \Closure(\OCP\IUser):?bool $callback - * @since 11.0.0 - */ public function callForSeenUsers(\Closure $callback) { - $limit = 1000; - $offset = 0; - do { - $userIds = $this->getSeenUserIds($limit, $offset); - $offset += $limit; - foreach ($userIds as $userId) { - foreach ($this->backends as $backend) { - if ($backend->userExists($userId)) { - $user = $this->getUserObject($userId, $backend, false); - $return = $callback($user); - if ($return === false) { - return; - } - break; - } - } + $users = $this->getSeenUsers(); + foreach ($users as $user) { + $return = $callback($user); + if ($return === false) { + return; } - } while (count($userIds) >= $limit); + } } /** |