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 commit is contained in:
Marcin Łojewski
2018-05-11 18:28:37 +02:00
committed by GitHub
parent ebcdaa813b
commit 7649d23052

View File

@@ -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);