From f7cc52433ccda8137ecc6e9068f41a04981c0ac8 Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Tue, 10 Nov 2020 20:59:11 +0100 Subject: [PATCH] #1124 Fixed pilerpurge to remove the last referenced attachment Signed-off-by: Janos SUTO --- util/pilerpurge.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util/pilerpurge.py b/util/pilerpurge.py index 9de546f3..3239cd1a 100755 --- a/util/pilerpurge.py +++ b/util/pilerpurge.py @@ -93,7 +93,12 @@ def purge_attachments_by_attachment_id(opts={}): if rows == (): break else: - remove_attachment_files(rows, opts) + for (id, piler_id, attachment_id, refcount) in rows: + if opts['dry_run'] is False: + unlink(get_attachment_file_path(piler_id, attachment_id, + opts), opts) + else: + print(get_attachment_file_path(piler_id, attachment_id, opts)) def remove_attachment_files(rows=(), opts={}):