Skip to content

Commit

Permalink
Don't die with LockedException when removing/restoring multiple files…
Browse files Browse the repository at this point in the history
… from trash

fixes issue #16491

Signed-off-by: Sven Strickroth <email@cs-ware.de>
  • Loading branch information
csware committed Aug 15, 2021
1 parent 35e73e4 commit ea801ce
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions apps/files_trashbin/lib/Trashbin.php
Original file line number Diff line number Diff line change
Expand Up @@ -968,9 +968,13 @@ private static function getVersionsFromTrash($filename, $timestamp, $user) {
[$storage,] = $view->resolvePath('/');

//force rescan of versions, local storage may not have updated the cache
if (!self::$scannedVersions) {
$storage->getScanner()->scan('files_trashbin/versions');
self::$scannedVersions = true;
while (!self::$scannedVersions) {
try {
$storage->getScanner()->scan('files_trashbin/versions');
self::$scannedVersions = true;
} catch (LockedException $e) {
// potentially a concurrent remove/restore from trash is running
}
}

$pattern = \OC::$server->getDatabaseConnection()->escapeLikeParameter(basename($filename));
Expand Down

0 comments on commit ea801ce

Please sign in to comment.