keep a list of users we already checked to avoid loops
This commit is contained in:
parent
dd972f65a8
commit
6ae761d946
1 changed files with 3 additions and 3 deletions
|
@ -32,19 +32,19 @@ class Shared_Updater {
|
|||
$uid = \OCP\User::getUser();
|
||||
$uidOwner = \OC\Files\Filesystem::getOwner($target);
|
||||
$info = \OC\Files\Filesystem::getFileInfo($target);
|
||||
$currentOwner = $uidOwner;
|
||||
$checkedUser = array($uidOwner);
|
||||
// Correct Shared folders of other users shared with
|
||||
$users = \OCP\Share::getUsersItemShared('file', $info['fileid'], $currentOwner, true);
|
||||
if (!empty($users)) {
|
||||
while (!empty($users)) {
|
||||
$reshareUsers = array();
|
||||
foreach ($users as $user) {
|
||||
if ( $user !== $currentOwner ) {
|
||||
if ( in_array($user, $checkedUser) ) {
|
||||
$etag = \OC\Files\Filesystem::getETag('');
|
||||
\OCP\Config::setUserValue($user, 'files_sharing', 'etag', $etag);
|
||||
// Look for reshares
|
||||
$reshareUsers = array_merge($reshareUsers, \OCP\Share::getUsersItemShared('file', $info['fileid'], $user, true));
|
||||
$currentOwner = $user;
|
||||
$checkedUser[] = $user;
|
||||
}
|
||||
}
|
||||
$users = $reshareUsers;
|
||||
|
|
Loading…
Reference in a new issue