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

Remove old media from plugin? #128

Open
scottmckendry opened this issue Apr 6, 2024 · 2 comments
Open

Remove old media from plugin? #128

scottmckendry opened this issue Apr 6, 2024 · 2 comments

Comments

@scottmckendry
Copy link

I have a plugin in Dotfyle where there is an image that no longer exists on the main branch but persists on the plugin page.

It would be good (as an author) to have an option to clean up old media. Or even if there was some additional logic in the media indexer to remove legacy images etc.

@codicocodes
Copy link
Owner

Makes sense, I know of the issue but haven't gotten to it!

There will be some issues with previously published TWiN issues containing stale image urls -> but I'm not sure how to solve that without storing the images myself, which I will not do at this time.

I'd likely go with deleting stale images that are no longer available in the readme, this would be the relevant code if anyone wants to pick this up

// TODO: 1. allow multiple plugins per media url
// TODO: 2. Remove stale media
await Promise.all([
data.map(async (m) => {
return await prismaClient.media.upsert({
where: {
url: m.url
},
create: m,
update: m
});
})
]);
}

@slugbyte
Copy link

slugbyte commented Jun 19, 2024

I tried making a patch for this issue in PR #140, but I ran a few more testes and realized I still need to do some more work on it, because my delete query is crashing the seeder. I closed the PR for now because Its not working code

I'll try and work on it more tomorrow.

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