keep a list of users we already checked to avoid loops

This commit is contained in:
Bjoern Schiessle 2013-10-18 17:35:56 +02:00
parent dd972f65a8
commit 6ae761d946

View file

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