use OC\Files\Node\Folder;
use OC\Files\Node\NonExistingFile;
use OC\Files\Node\NonExistingFolder;
-use OC\Files\ObjectStore\ObjectStoreStorage;
use OC\Files\View;
use OC_User;
use OCA\Files_Trashbin\AppInfo\Application;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
+use OCP\Files\Storage\ILockingStorage;
+use OCP\Files\Storage\IStorage;
use OCP\FilesMetadata\IFilesMetadataManager;
use OCP\IConfig;
use OCP\Lock\ILockingProvider;
$trashPath = '/files_trashbin/files/' . static::getTrashFilename($filename, $timestamp);
$gotLock = false;
- while (!$gotLock) {
+ do {
+ /** @var ILockingStorage & IStorage $trashStorage */
+ [$trashStorage, $trashInternalPath] = $ownerView->resolvePath($trashPath);
try {
- /** @var \OC\Files\Storage\Storage $trashStorage */
- [$trashStorage, $trashInternalPath] = $ownerView->resolvePath($trashPath);
-
$trashStorage->acquireLock($trashInternalPath, ILockingProvider::LOCK_EXCLUSIVE, $lockingProvider);
$gotLock = true;
} catch (LockedException $e) {
$trashPath = '/files_trashbin/files/' . static::getTrashFilename($filename, $timestamp);
}
- }
+ } while (!$gotLock);
$sourceStorage = $sourceInfo->getStorage();
$sourceInternalPath = $sourceInfo->getInternalPath();
return false;
}
-
try {
$moveSuccessful = true;
- // when moving within the same object store, the cache update done below is enough to move the file
- if (!($trashStorage->instanceOfStorage(ObjectStoreStorage::class) && $trashStorage->getId() === $sourceStorage->getId())) {
- $trashStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
+ $trashStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
+ if ($sourceStorage->getCache()->inCache($sourceInternalPath)) {
+ $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
}
if ($trashStorage->getCache()->inCache($sourceInternalPath)) {
$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);