Uh oh!
There was an error while loading. Please reload this page.
Let occ trashbin:restore restore also from groupfolders and add filters - #39818
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
627a517 to
d2581e5CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
R0Wi
commented
Aug 13, 2023
CI errors seems unrelated |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
occ trashbin:restore restore also from groupfolders and add filtersUh oh!
There was an error while loading. Please reload this page.
come-nc
left a comment
There was a problem hiding this comment.
Nice improvement of the command
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
come-nc
commented
Aug 14, 2023
Did you test the command with groupfolders application not installed? |
First of all thanks for your thorough review. Will try to incorporate the changes ASAP. Indeed I did not yet test it without the Groupfolders app installed but since there's no direct reference to it, it should work. I can do that after I've improved the code 👍 EDIT Code improved and also tested without Groupfolders app. Works fine |
solracsf
commented
Aug 14, 2023
@R0Wi sorry but can you just insert in the 1st post the result of commands but with GF disabled, like:
Thanks 👍 |
R0Wi
commented
Aug 16, 2023
@solracsf please find the test-script attached. Note that no groupfolders app was installed. devcontainer@a9176d865258:/var/www/html$ php occ app:list 2>/dev/null
Enabled:
- cloud_federation_api: 1.11.0
- comments: 1.18.0
- contactsinteraction: 1.9.0
- dashboard: 7.8.0
- dav: 1.28.0
- federatedfilesharing: 1.18.0
- federation: 1.18.0
- files: 1.23.0
- files_reminders: 1.0.0
- files_sharing: 1.20.0
- files_trashbin: 1.18.0
- files_versions: 1.21.0
- lookup_server_connector: 1.16.0
- oauth2: 1.16.2
- provisioning_api: 1.18.0
- settings: 1.10.0
- sharebymail: 1.18.0
- systemtags: 1.18.0
- theming: 2.3.0
- twofactor_backupcodes: 1.17.0
- updatenotification: 1.18.0
- user_status: 1.8.0
- weather_status: 1.8.0
- workflowengine: 2.10.0
Disabled:
- admin_audit: 1.18.0
- encryption: 2.16.0
- files_external: 1.20.0
- testing: 1.18.0
- user_ldap: 1.19.0
devcontainer@a9176d865258:/var/www/html$ php occ trashbin:restore --dry-run --all-users --scope groupfolders -v 2>/dev/null
Restoring deleted files for all users
Restoring deleted files for users on backend Database
admin
Skipping welcome.txt because it is not a groupfolders trash item
User has no deleted files in the trashbin matching the given filters
devcontainer@a9176d865258:/var/www/html$ php occ trashbin:restore --dry-run --all-users --scope all 2>/dev/null Restoring deleted files for all users
Restoring deleted files for users on backend Database
admin
Would restore 1 files...
Would restore welcome.txt originally deleted at 14. August 2023, 10:43:41 UTC to /welcome.txt
devcontainer@a9176d865258:/var/www/html$ php occ trashbin:restore --dry-run --all-users --scope user -v 2>/dev/null Restoring deleted files for all users
Restoring deleted files for users on backend Database
admin
Would restore 1 files...
Would restore welcome.txt originally deleted at 14. August 2023, 10:43:41 UTC to /welcome.txt
devcontainer@a9176d865258:/var/www/html$ php occ trashbin:restore --dry-run --all-users --scope all --since "12.08.2023 13:04:44" --until "12.08.2023 13:04:46" -v 2>/dev/null Restoring deleted files for all users
Restoring deleted files for users on backend Database
admin
Skipping welcome.txt because it was deleted after the 'until' timestamp
User has no deleted files in the trashbin matching the given filtersNote that I adjusted the verbose output of the last command to match the new parameter names in 66c88cc |
…ional filters * Using the TrashManager allows access to all deleted files * Add 'scope' parameter to choose where to restore from (user or groupfolders) * Add 'restore-from' and 'restore-to' date parameters to filter files to be restored by their deletion date * Add 'dry-run' flag to be able to see which files would be restored and being able to adjust the filter parameters accordingly Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
* Delete unnecessary function docs * Rename parameters to 'since' and 'until' * Style: use '&&' instead of 'and' * Add types Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
66c88cc to
d7a73ffCompareR0Wi
commented
Aug 18, 2023
solracsf
commented
Aug 18, 2023
Just waiting from reviews from core developpers :) |
artonge
left a comment
There was a problem hiding this comment.
Looks good overall.
From what I read, it should work if groudfolders is not installed. Can you confirm that?
| // We use getTitle() here instead of getOriginalLocation() because | ||
| // for groupfolders this contains the groupfolder name itself as prefix | ||
| // which makes it more human readable | ||
| $location = $trashItem->getTitle(); |
There was a problem hiding this comment.
The goal is to display the groupfolder name ? Could the following work?
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
$userFolder->get($trashItem->getOriginalLocation())->getMountPoint()->getInternalPath();R0Wi
commented
Aug 21, 2023
That's correct. I tested both situations where the |
R0Wi
commented
Sep 3, 2023
@artonge I don't want to put too much preasure on this but any additional feedback would be really appreciated. My customer would be highly interested in this new feature. Thanks 👍 |
R0Wi
commented
Sep 16, 2023
@come-nc anything to add from your side? |
come-nc
commented
Sep 18, 2023
I’m still uneasy about this |
artonge
commented
Sep 18, 2023
@R0Wi I'll let you merge if everything is good on your side :) |
R0Wi
commented
Sep 22, 2023
/backport to stable27 |
Resolves: #39724
Summary
Let
occ trashbin:restorerestore also from groupfolders and add additional filtersrestored by their deletion date
able to adjust the filter parameters accordingly
Manual testcases
Showcase
Assume we have two files in our trashbin. One is
Userfile.txtwhich was deleted from a users private directory. The other one isGroupfoldersFile.jpgwhich was deleted from a groupfoldergf1where useradmin(which we use for restore) has access to.TODO
ITrashBackendwhich would be found by theTrashManager: are there any of them and if yes, how to deal with them?Checklist