diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-07-12 14:22:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-12 14:22:10 +0200 |
commit | e9b635aa14092a661b826da7ddc1cb585042796c (patch) | |
tree | f8c9da9db54ef1fc04f124b8e50612e01cc6901a /apps/files_trashbin/lib | |
parent | b2017cd5574fa2a4b4812ad5fa5c89dd9cd4dc7a (diff) | |
parent | 6f6ccfcc18983c9fe4da383e1047f79dcfdd1042 (diff) | |
download | nextcloud-server-e9b635aa14092a661b826da7ddc1cb585042796c.tar.gz nextcloud-server-e9b635aa14092a661b826da7ddc1cb585042796c.zip |
Merge pull request #32507 from carlcsaposs/restore
Sort files by deletion time before restoring in RestoreAllFiles
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r-- | apps/files_trashbin/lib/Command/RestoreAllFiles.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/files_trashbin/lib/Command/RestoreAllFiles.php b/apps/files_trashbin/lib/Command/RestoreAllFiles.php index 43e9363327b..748ead798d8 100644 --- a/apps/files_trashbin/lib/Command/RestoreAllFiles.php +++ b/apps/files_trashbin/lib/Command/RestoreAllFiles.php @@ -129,7 +129,11 @@ class RestoreAllFiles extends Base { \OC_Util::setupFS($uid); \OC_User::setUserId($uid); - $filesInTrash = Helper::getTrashFiles('/', $uid, 'mtime'); + // Sort by most recently deleted first + // (Restoring in order of most recently deleted preserves nested file paths. + // See https://github.com/nextcloud/server/issues/31200#issuecomment-1130358549) + $filesInTrash = Helper::getTrashFiles('/', $uid, 'mtime', true); + $trashCount = count($filesInTrash); if ($trashCount == 0) { $output->writeln("User has no deleted files in the trashbin"); |