Skip to content

Commit

Permalink
feat: versioned storages are expected to handle retainVersions themse…
Browse files Browse the repository at this point in the history
…lves
  • Loading branch information
DeepDiver1975 committed Dec 7, 2021
1 parent 592638f commit f084e60
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions apps/files_trashbin/lib/Trashbin.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
use OCP\Encryption\Keys\IStorage;
use OCP\Files\ForbiddenException;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IVersionedStorage;
use OCP\Files\StorageNotAvailableException;
use OCP\Lock\LockedException;
use OCP\User;
Expand Down Expand Up @@ -375,11 +376,13 @@ public static function move2trash($file_path) {
'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)
]);

self::retainVersions($filename, $owner, $ownerPath, $timestamp, $sourceStorage);
if (!$sourceStorage->instanceOfStorage(IVersionedStorage::class)) {
self::retainVersions($filename, $owner, $ownerPath, $timestamp, $sourceStorage);

// if owner !== user we need to also add a copy to the owners trash
if ($user !== $owner) {
self::copyFilesToUser($ownerPath, $owner, $file_path, $user, $timestamp);
// if owner !== user we need to also add a copy to the owners trash
if ($user !== $owner) {
self::copyFilesToUser($ownerPath, $owner, $file_path, $user, $timestamp);
}
}
}

Expand Down

0 comments on commit f084e60

Please sign in to comment.