removeoldips.py 581 B

123456789101112131415161718
  1. from django.core.management import BaseCommand
  2. from misago.conf import settings
  3. from misago.users.signals import remove_old_ips
  4. class Command(BaseCommand):
  5. help = "Removes users IPs stored for longer than set in MISAGO_IP_STORE_TIME."
  6. def handle(self, *args, **options):
  7. if not settings.MISAGO_IP_STORE_TIME:
  8. self.stdout.write("Old IP removal is disabled.")
  9. return
  10. remove_old_ips.send(sender=self)
  11. self.stdout.write(
  12. "IP addresses older than %s days have been removed." % settings.MISAGO_IP_STORE_TIME)