Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trashbin cannot be cleared with group folder data #314

Closed
hriekehof opened this issue Feb 11, 2019 · 14 comments
Closed

Trashbin cannot be cleared with group folder data #314

hriekehof opened this issue Feb 11, 2019 · 14 comments
Labels
1. to develop Issues that are ready for development bounty bug feature: trashbin Items related to the trashbin feature high high priority workaround

Comments

@hriekehof
Copy link

hriekehof commented Feb 11, 2019

I'm running NC 15.0.4 with the group folder plugin 2.0.2. At the moment i have the strange behavior.

  1. I delete some files in a group folder and they appear in the trash bin of every user which as access to the group folder. I can safely restore files from there.
  2. When i try to empty the trash bin it seems to work in the first place but when i refresh the side. All files i deleted show up again. I can also still restore them if i want. It seems that it is not possible to empty the trashbin of group folder deleted files.
  3. When i run trashbin:cleanup for all users. The files still appear in the trashbin

Has someone else experienced something like this ?

@hriekehof
Copy link
Author

Ok i have to add something. I recognized a minute ago that when i mark the file and folders one by one and delete empty the tashbin it seems to works. But when i use the mark all button in the top left it doesn't.

@PpaiSanchez
Copy link

Same here

@rerobins
Copy link

This appears to be because the call that is made to delete all of the files is different than multi-selected files. For deleting all trashed files, a DAV DELETE request is sent with the trash path, and multi-selected deletes each file individually.

It appears that if the deleteAll call in TrashBin.php is returning if there isn't a trash bin path defined for the user, which is preventing the code from advancing to part where the deleteAll event is fired off. Adding a non-group folder file and deleting it creates this trashbin directory and allows progress to move on.
https://github.com/nextcloud/server/blob/49e161d1ad9f7de42bdc5addae3fe0b2541d09cf/apps/files_trashbin/lib/Trashbin.php#L497

This doesn't actually fix the issue, but does allow us to get to the code where the deleteAll event is fired off. It appears that GroupFolders should subscribe to the event:

		\OC_Hook::emit('\OCP\Trashbin', 'deleteAll', array('paths' => $filePaths));

(From: https://github.com/nextcloud/server/blob/49e161d1ad9f7de42bdc5addae3fe0b2541d09cf/apps/files_trashbin/lib/Trashbin.php#L524)

and delete all of the files that are stored in the groupfiles trashbackend. Note $filePaths is going to be an empty array because it is built off of the values that are stored in files trashbin.

NOTE: This is based on NextCloud 15 only.

@DBJRdev
Copy link

DBJRdev commented Aug 21, 2019

I can confirm that the problem persists in NC 16.0.4 and Group folders 4.0.5

@ernolf
Copy link

ernolf commented Dec 22, 2019

I have the problem, that a trashbin from one group folder is physically deleted (trashbin has been deleted manually on server file system level, I know, it was dumb)
occ groupfolders:scan does not scan the trashbin. I understand that scanning the trashbin for NEW files would be impossible, since they need the meta data from where they came from etc. but is there a way, to get those entries out of my mariadb database?
A scan mechanism that recognises the absence of files registered in trash, would that not be a good idea?
Who knows the mysql commands to do this job by hand or does there exist a how to somewhere out there?

Thanks a lot in advance for any answer 💞

edit 1:
I was able to almost completely reconstruct the physical trashbin with the logfiles, replacing the missing files by empty files with the same name but two items are stil there, unable to remove them out of my deleted files window. They where from earlier not complete uploaded and then deleted files. A clue how to remove those entries?
I am missing an occ -task dealing with this kind of inconsistencies.

edit 2:
✅ Solution
The zombie-entries disapear after a "Restore". Only an error message in logfile "unable to rename, file does not exists .... (path/to/trashbin/filename)" appears but it restores the file-entry in the webview. After it is restored, it is easy to remove that entry (without underlying file in the filesystem) by simply deleting it again or do an occ groupfolders:scan

@bastiencyr
Copy link

Hello,

I have a provisional solution to empty the trashbin. Do this :

  1. select the mark all button and suppress all (only files NOT in group folder will be removed)
  2. select the mark all button again, and uncheck only one file on the list.
  3. Remove all files (except the one last file)
  4. it works for me

Hoping it really works :)

@alexisberindei
Copy link

Thank you @bastiencyr this workaround works for me.

@freiheitswolke-org
Copy link

Hey,
we opened a bounty on this missing function.
Please spread the voice and contribute as you can:
https://www.bountysource.com/issues/69919948-tashbin-cannot-be-cleared-with-group-folder-data

@rakekniven rakekniven changed the title Tashbin cannot be cleared with group folder data Trashbin cannot be cleared with group folder data Oct 7, 2020
@expert-geeks
Copy link

Function to clear group folders trash has recently been added by rullzer & juliushaertl (thanks guys!)

sudo -u www-data php /var/www/nextcloud/occ groupfolders:trashbin:cleanup

@jothoma1
Copy link

jothoma1 commented Nov 4, 2020

Really nice to have occ groupfolders:trashbin:cleanup
Thanks !

It will be great if we can specify a duration like only delete file older than 7 days

@ZeikoFr
Copy link

ZeikoFr commented Nov 15, 2020

Yes I agree, I proposed to link this new function with the parameter 'trashbin_retention_obligation' in this issue. Sadly i'm a really bad programmer and can't develop this myself....
##345

@pierreozoux pierreozoux added 0. Needs triage Issues that need to be triaged feature: trashbin Items related to the trashbin feature workaround ui bug labels Mar 14, 2021
@pierreozoux pierreozoux removed the ui label Apr 2, 2021
@fschrempf fschrempf added high high priority bounty labels Apr 9, 2021
@fschrempf fschrempf added 1. to develop Issues that are ready for development and removed 0. Needs triage Issues that need to be triaged labels Apr 30, 2021
@CarlSchwan
Copy link
Member

I believe this issue can be closed. From the original comment:

  1. I delete some files in a group folder and they appear in the trash bin of every user which as access to the group folder. I can safely restore files from there.
  2. When i try to empty the trash bin it seems to work in the first place but when i refresh the side. All files i deleted show up again. I can also still restore them if i want. It seems that it is not possible to empty the trashbin of group folder deleted files.

Works for me now locally with 200 items in my trash bin with both master and stable22

  1. When i run trashbin:cleanup for all users. The files still appear in the trashbin

Works with sudo -u www-data ./occ groupfolders:trashbin:cleanup. I don't think trashbin:cleanup --all-users should also delete groupfolders trash as a groupfolders is explicitly not owned by a user.

Additionally, points mentioned in this ticket about trash retentions have also been fixed recently and landed in NC 23.

Please fill free to reopen if you think I missed something :)

@unsalkorkmaz
Copy link

unsalkorkmaz commented Jul 8, 2022

Why is this closed?
problem is still here. I still cant delete a folder

@punkyard
Copy link

this worked for me:

empty all bins of all users:
sudo -u www-data php /var/www/html/occ trashbin:cleanup --all-users

empty groupfloder bins:
sudo -u www-data php /var/www/html/occ groupfolders:trashbin:cleanup

or go to the the folder of your NC installation and occ file (doesn't work if you can't access Command Line Interface) and run the commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Issues that are ready for development bounty bug feature: trashbin Items related to the trashbin feature high high priority workaround
Projects
None yet
Development

No branches or pull requests