From e05c112af4d474476d9a52700451fa40e46ee055 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sat, 25 May 2019 14:44:40 -0400 Subject: [PATCH] make sure we don't zap our own files --- honk.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/honk.go b/honk.go index bde6135..302a9f6 100644 --- a/honk.go +++ b/honk.go @@ -1316,7 +1316,7 @@ func cleanupdb() { } } expdate := time.Now().UTC().Add(-30 * 24 * time.Hour).Format(dbtimeformat) - doordie(db, "update files set content = '', local = 0 where length(content) > 20000 and fileid in (select fileid from donks join honks on donks.honkid = honks.honkid where honks.dt < ? and whofore = 0)", expdate) + doordie(db, "update files set content = '', local = 0 where length(content) > 20000 and fileid in (select fileid from donks join honks on donks.honkid = honks.honkid where honks.dt < ? and whofore = 0) and fileid not in (select fileid from donks join honks on donks.honkid = honks.honkid where whofore = 2)", expdate) doordie(db, "delete from files where fileid not in (select fileid from donks)") }