removeoldips.py 585 B

1234567891011121314151617181920
  1. from django.core.management import BaseCommand
  2. from ....conf import settings
  3. from ...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."
  13. % settings.MISAGO_IP_STORE_TIME
  14. )