forget all shadowed files (uploads too); closes #120

shadowing is the act of intentinoally blocking off access to
files in a volume by placing another volume atop of a file/folder.

say you have volume '/' with a file '/a/b/c/d.txt'; if you create a
volume at '/a/b', then all files/folders inside the original folder
becomes inaccessible, and replaced with the contents of the new vol

the initial code for forgetting shadowed files from the parent vol
database would only forget files which were discovered during a
filesystem scan; any uploaded files would be intentionally preseved
in the parent volume's database, probably to avoid losing uploader
info in the event of a brief mistaken config change, where a volume
is shadowed by accident.

this precaution was a mistake, currently causing far more
issues than it solves (#61 and #120), so away it goes.

huge thanks to @Gremious for doing all the legwork on this!
This commit is contained in:
ed 2024-11-28 22:01:18 +00:00
parent 2ce8233921
commit d168b2acac

View file

@ -1652,7 +1652,7 @@ class Up2k(object):
# drop shadowed folders
for sh_rd in unreg:
n = 0
q = "select count(w) from up where (rd=? or rd like ?||'/%') and +at == 0"
q = "select count(w) from up where (rd=? or rd like ?||'/%')"
for sh_erd in [sh_rd, "//" + w8b64enc(sh_rd)]:
try:
erd_erd = (sh_erd, sh_erd)
@ -1670,7 +1670,7 @@ class Up2k(object):
q = "delete from dh where (d = ? or d like ?||'/%')"
db.c.execute(q, erd_erd)
q = "delete from up where (rd=? or rd like ?||'/%') and +at == 0"
q = "delete from up where (rd=? or rd like ?||'/%')"
db.c.execute(q, erd_erd)
tfa += n