Iām running Nextcloud 12 on Ubuntu and I figured out that when I delete a file (i.e. a picture) its preview files are not being deleted.
Well, letās put it this way⦠It seems like they are being deleted, but at the same time, some new preview files are being created.
I recorded my screen to show you what is going on.
In the video Iām going to upload a picture, then Iām going to look at the previews so that those are created and then I delete the file again. Simultaniously I keep an eye on the appdata_appid/preview folder. Watch the preview folder/file dates, then youāll see what I mean.
The issue was about a possible regular cleaning job, if some images is being NOT deleted via Nextcloud webui/client. Because there is one that cleans the file database, but I did not find some hint in the code that previews will be cleaned as well with it.
But the issue you found suggests that there is an additional problem, IF the images are removed regularly. I did not find the time to reproduce it so far. Is there a way to easily find out about a files id? In address field (opening something in files app) I see some id, but it seems to be one of the folder (and no related entry in previews folder) not the file itself.
Would be also interesting to know, how images, removed just to trash bin are handled, if their id stays the same and previews stay until trash bin clearing or not.
Could it be that this topic is still not solved or is a problem now again?
I made some tests with my newly installed nextcloud 18.0.3.
Upload an image
Use one of the two methods to create the preview of the file:
Browse nextcloud directory of uploaded file
Use preview generator app to generate previews with occ command (sudo -u nginx php /srv/www/nextcloud/occ preview:pre-generate) which will process the entry in the table oc_preview_generation that was created by uploading the file
Have a look into the directory /srv/www/nextcloud/data/appdata_XXXXXXXX/preview. There is a directory named after the fileid (from āoc_filecacheā table) with the previews of the image.
Delete the file in the web interface and also delete it in the trashbin of the webinterface.
Wait for the cron job to run or run it manually by using e.g. systemctl start nextcloudcron.service (when the setup is done with systemd like descriped here: https://docs.nextcloud.com/server/18/admin_manual/configuration_server/background_jobs_configuration.html#systemd.
This point is quite interesting, because I didnāt yet understand 100% how this works. There is the table oc_jobs with all the defined background tasks. One of them is OC\Preview\BackgroundCleanupJob. According to some github conversations I think this one should be responsible for deleting the obsolete file previews. Iāve also set the last_run to 0 and then startet the cron manually to force the execution of this task.
My expected behavior is, that the obsolete file previews are delete. But if I browse /srv/www/nextcloud/data/appdata_XXXXXXXX/preview the files are still there. Also in the table oc_filecache The entries are not deleted⦠Only the ID 3745 which was the entry for the actual file has been deleted.
What is going on here? Is this still an issues for all nextcloud instances or only on my configuration? Can someone of you test it with your setup and let me know?
I have set the the log to ādebugā and I get the following messages:
[no app in context] Debug: Deprecated event type for \OCP\Files::postDelete: Symfony\Component\EventDispatcher\GenericEvent
at 2020-03-29T21:20:34+02:00
[no app in context] Debug: Deprecated event type for \OCP\Files::preDelete: Symfony\Component\EventDispatcher\GenericEvent
at 2020-03-29T21:20:34+02:00