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

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

Open
sg-modlab opened this issue Nov 8, 2024 · 4 comments

Comments

@sg-modlab
Copy link

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
Copy link
Contributor

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
Copy link
Author

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
Copy link

AdamChlan commented Nov 15, 2024

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?

@AdamChlan
Copy link

Noting that we figured out our issue, and the plugin is working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants