born05 / craft-assetusage

Craft plugin adds a column to see which assets are used or unused.
MIT License
33 stars 8 forks source link

Delete all unused assets seemed to delete from DB but not the actual files #47

Open sg-modlab opened 1 week ago

sg-modlab commented 1 week ago

Craft 4.9.2 Asset Usage 3.3.0

I ran the CLI to delete all unused assets. It completed and in reviewing the asset manager of the control panel, it all looked good. I reran the index and notice they all came back. Seems the actual files were not deleted. Is there something I should have done or a step I might have missed?

roelvanhintum commented 5 days ago

Hi @sg-modlab, the plugin calls Craft::$app->getElements()->deleteElement($asset), same as Craft does, i don't know how the deletion itself works. It is also filesystem specific. You could delete a file manually from the control panel and check if that works differently.

sg-modlab commented 19 hours ago

Thanks for the reply and details. I had another team member try the command and saw the same thing as I had and we had same result. Did not actually delete the file. When deleting via the control panel as you suggested, it does delete the file.

AdamChlan commented 15 hours ago

Hello, I am the team member Seth mentioned. We ran a couple tests locally, and then tried on a staging environment. We tried on two different sites. In all cases the files were not deleted from our assets folder. We did see that with the Craft command being used, there could be a delay for the files to be deleted. Maybe these are soft deletes? I'm curious with your testing, do you see the files delete immediately, or should we expect a delay?