From 7649d230529ba390a54ba21d0c9808ce75c51cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20=C5=81ojewski?= Date: Fri, 11 May 2018 18:28:37 +0200 Subject: [PATCH] Manage limit and offset in usersInGroup function Since user_sql apps don't manage limit and offset in **usersInGroup** function: `$rows = $this -> helper -> runQuery('getGroupUsers', array('gid' => $gid), false, true);` The unshareFromGroup function of **Activity** app start a infinity loop : ``` while (!empty($users)) { $this->addNotificationsForGroupUsers($users, 'unshared_by', $share->getNodeId(), $share->getNodeType(), $share->getTarget(), $share->getId()); $offset += self::USER_BATCH_SIZE; $users = $group->searchUsers('', self::USER_BATCH_SIZE, $offset); } ``` to fix that, just add offset and limit params to runQuery : ``` $rows = $this -> helper -> runQuery('getGroupUsers', array('gid' => $gid), false, true, ['limit' => $limit, 'offset' => $offset]); ``` --- ...$this -> helper -> runQuery('getGroupUsers', array('gid' =>} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename lib/{group_sql.php => $rows = $this -> helper -> runQuery('getGroupUsers', array('gid' =>} (97%) diff --git a/lib/group_sql.php b/lib/$rows = $this -> helper -> runQuery('getGroupUsers', array('gid' => similarity index 97% rename from lib/group_sql.php rename to lib/$rows = $this -> helper -> runQuery('getGroupUsers', array('gid' => index b0c1c06..363f7f9 100644 --- a/lib/group_sql.php +++ b/lib/$rows = $this -> helper -> runQuery('getGroupUsers', array('gid' => @@ -64,7 +64,7 @@ class OC_GROUP_SQL extends \OC_Group_Backend implements \OCP\GroupInterface Util::writeLog('OC_USER_SQL', "Group table not configured", Util::DEBUG); return []; } - $rows = $this -> helper -> runQuery('getGroupUsers', array('gid' => $gid), false, true); + $rows = $this -> helper -> runQuery('getGroupUsers', array('gid' => $gid), false, true, ['limit' => $limit, 'offset' => $offset]); if($rows === false) { Util::writeLog('OC_USER_SQL', "Found no users for group", Util::DEBUG);