WIP: fix attachment cleanup after media domain migration #818

Draft
Oneric wants to merge 2 commits from Oneric/akkoma:attachcleanup-uploadmigration into develop
Member

Originally brought up as apart of #789 and depends on this PR

The current patch requires admins to keep a list of all past domains; this isn’t the most elegant solution, but if properly set works reliably and also reduces points of concern for a future™ migration of the whole upload db scheme (see #765; after which this fix becomes obsolete anyway)
(We could also add a mix task to verify all uploads match a listed base url)

An alternative not requiring so much admin action was suggested by FloatingGhost:

suggestion: best-effort in which we check for the same base domain

for example, we consider an attachment deletable if its base domain (x.(MATCHES.net)) is the same as our endpoint OR media URLs - which should account for both media migrated to s3 and people that just moved to a subdomain

This is probably fine for attachment cleanup, but missed mappings will be more severe for the aforementioned migration. Ofc, we could also just delay worrying about the migration until it actually happens (i’d prefer not to though)

Unless there’s a solution working both reliably and not needing so much manual admin action, this is pretty much a subjective weighting between different drawbacks, so i’ll just adapt the patch to match whatever the final decision yields

Originally brought up as apart of #789 and depends on this PR The current patch requires admins to keep a list of all past domains; this isn’t the most elegant solution, but if properly set works reliably and also reduces points of concern for a future™ migration of the whole upload db scheme (see #765; after which this fix becomes obsolete anyway) (We could also add a mix task to verify all uploads match a listed base url) An alternative not requiring so much admin action was suggested by FloatingGhost: > suggestion: best-effort in which we check for the same base domain > > for example, we consider an attachment deletable if its base domain (x.(MATCHES.net)) is the same as our endpoint OR media URLs - which should account for both media migrated to s3 and people that just moved to a subdomain This is probably fine for attachment cleanup, but missed mappings will be more severe for the aforementioned migration. Ofc, we could also just delay worrying about the migration until it actually happens (i’d prefer not to though) Unless there’s a solution working both reliably and not needing so much manual admin action, this is pretty much a subjective weighting between different drawbacks, so i’ll just adapt the patch to match whatever the final decision yields
Oneric added 2 commits 2024-07-06 01:40:54 +00:00
this is #789
squahsed into a single commit
Allow deleting uploaded files after media migration
Some checks are pending
ci/woodpecker/pr/build-amd64 Pipeline is pending
ci/woodpecker/pr/build-arm64 Pipeline is pending
ci/woodpecker/pr/docs Pipeline is pending
ci/woodpecker/pr/lint Pipeline is pending
ci/woodpecker/pr/test Pipeline is pending
219fffa0c3
Until now only the current base_url was checked.
After a media domain migration all pre-existing files
thus turned undeletable. Fix this with a new config
option allowing to list all old media base urls.
(This may also come in handy for a later db refactor, see
 #765)
Some checks are pending
ci/woodpecker/pr/build-amd64 Pipeline is pending
ci/woodpecker/pr/build-arm64 Pipeline is pending
ci/woodpecker/pr/docs Pipeline is pending
ci/woodpecker/pr/lint Pipeline is pending
ci/woodpecker/pr/test Pipeline is pending
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u attachcleanup-uploadmigration:Oneric-attachcleanup-uploadmigration
git checkout Oneric-attachcleanup-uploadmigration
Sign in to join this conversation.
No description provided.