mirror of
https://github.com/zulip/zulip.git
synced 2025-10-27 01:53:59 +00:00
management: Fix delete_old_unclaimed_attachments.
This commit is contained in:
@@ -15,7 +15,8 @@ class Command(BaseCommand):
|
|||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('-w', '--weeks',
|
parser.add_argument('-w', '--weeks',
|
||||||
dest='delta_weeks',
|
dest='delta_weeks',
|
||||||
default=1,
|
default=5,
|
||||||
|
type=int,
|
||||||
help="Limiting value of how old the file can be.")
|
help="Limiting value of how old the file can be.")
|
||||||
|
|
||||||
parser.add_argument('-f', '--for-real',
|
parser.add_argument('-f', '--for-real',
|
||||||
@@ -26,13 +27,12 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
def handle(self, *args: Any, **options: Any) -> None:
|
def handle(self, *args: Any, **options: Any) -> None:
|
||||||
delta_weeks = options['delta_weeks']
|
delta_weeks = options['delta_weeks']
|
||||||
print("Deleting unclaimed attached files older than %s" % (delta_weeks,))
|
print("Deleting unclaimed attached files older than %s weeks" % (delta_weeks,))
|
||||||
print("")
|
|
||||||
|
|
||||||
# print the list of files that are going to be removed
|
# print the list of files that are going to be removed
|
||||||
old_attachments = get_old_unclaimed_attachments(delta_weeks)
|
old_attachments = get_old_unclaimed_attachments(delta_weeks)
|
||||||
for old_attachment in old_attachments:
|
for old_attachment in old_attachments:
|
||||||
print("%s created at %s" % (old_attachment.file_name, old_attachment.create_time))
|
print("* %s created at %s" % (old_attachment.file_name, old_attachment.create_time))
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
if not options["for_real"]:
|
if not options["for_real"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user