From dc8bfde0b41b4269e56ab79f8fb9c6f8623aa6d5 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Wed, 23 Oct 2013 13:39:57 -0400 Subject: [PATCH] Add a check_apns_tokens manage.py command to flush old tokens (imported from commit 15dcfaa1967bd749b582882c4a816a457ca6cc12) --- .../management/commands/check_apns_tokens.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 zerver/management/commands/check_apns_tokens.py diff --git a/zerver/management/commands/check_apns_tokens.py b/zerver/management/commands/check_apns_tokens.py new file mode 100644 index 0000000000..a6d49769ef --- /dev/null +++ b/zerver/management/commands/check_apns_tokens.py @@ -0,0 +1,18 @@ +from __future__ import absolute_import + +from django.core.management.base import BaseCommand +from django.conf import settings + +from zerver.models import AppleDeviceToken + +from zerver.lib.push_notifications import check_apns_feedback +import logging + +class Command(BaseCommand): + help = """Checks the Apple Push Notifications Service for any tokens that have been + invalidated, and removes them from the database. + + Usage: ./manage.py check_apns_tokens""" + + def handle(self, *args, **options): + check_apns_feedback()