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

Fix resetdb after submitting UploadedDocuments #2237

Merged
merged 1 commit into from
May 20, 2024
Merged

Fix resetdb after submitting UploadedDocuments #2237

merged 1 commit into from
May 20, 2024

Conversation

bemoody
Copy link
Collaborator

@bemoody bemoody commented May 20, 2024

The original storage layout, designed by Chen, places all media files (and the dynamic static files) in subdirectories of subdirectories (media/active-projects/SHuKI1APLrwWCqxSQnSk, media/credential-applications/YgqTQmcerj0gLx4MAaZV, etc.)

Currently the UploadedDocument feature disregards this convention, and stores files in media/ethics.

Thus, it breaks the resetdb command, which assumes everything is stored in a subdirectory of a subdirectory.

In the original storage layout, all files in the media directory were
stored at least two subdirectories deep (the first being
"active-projects", "published-projects", "users", etc., and the second
being a project or user identifier.)

Some newer site features have disregarded this layout and store files
directly in a first-level subdirectory.  resetdb needs to delete those
files as well.

A simpler approach would be to recurse through the tree and delete
everything except ".gitkeep" files and their ancestors.  That does not
work at present because some demo active projects
(AGlSZa5VTv5Dg09CSpoh, omAiNz9yC3MXvZTRe9sF) themselves contain
".gitkeep" files.
@tompollard tompollard merged commit 5e21f67 into dev May 20, 2024
8 checks passed
@tompollard tompollard deleted the bm/resetdb branch May 20, 2024 19:14
@tompollard
Copy link
Member

looks good to me

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

Successfully merging this pull request may close these issues.

None yet

2 participants