Browse Source

fix #615: example cron.txt

Rafał Pitoń 8 years ago
parent
commit
8086b76f93

+ 4 - 0
misago/project_template/cron.txt

@@ -0,0 +1,4 @@
+15 0 * * * python manage.py buildactivepostersranking
+15 0 * * * python manage.py clearsessions
+15 0 * * * python manage.py invalidatebans
+15 0 * * * python manage.py prunecategories

+ 4 - 1
misago/users/management/commands/bansmaintenance.py → misago/users/management/commands/invalidatebans.py

@@ -7,7 +7,10 @@ from ...models import Ban, BanCache
 
 
 class Command(BaseCommand):
-    help = 'Runs maintenance on Misago bans system.'
+    help = (
+        "Runs maintenance on Misago bans system, "
+        "invalidating expired bans and pruning caches."
+    )
 
     def handle(self, *args, **options):
         self.handle_expired_bans()

+ 4 - 4
misago/users/tests/test_bansmaintenance.py → misago/users/tests/test_invalidatebans.py

@@ -8,11 +8,11 @@ from django.utils.six import StringIO
 from django.utils.six.moves import range
 
 from .. import bans
-from ..management.commands import bansmaintenance
+from ..management.commands import invalidatebans
 from ..models import Ban, BanCache
 
 
-class BansMaintenanceTests(TestCase):
+class InvalidateBansTests(TestCase):
     def test_expired_bans_handling(self):
         """expired bans are flagged as such"""
         # create 5 bans then update their valid date to past one
@@ -23,7 +23,7 @@ class BansMaintenanceTests(TestCase):
 
         self.assertEqual(Ban.objects.filter(is_checked=True).count(), 5)
 
-        command = bansmaintenance.Command()
+        command = invalidatebans.Command()
 
         out = StringIO()
         call_command(command, stdout=out)
@@ -47,7 +47,7 @@ class BansMaintenanceTests(TestCase):
         self.assertEqual(Ban.objects.filter(is_checked=True).count(), 1)
 
         # first call didn't touch ban
-        command = bansmaintenance.Command()
+        command = invalidatebans.Command()
 
         out = StringIO()
         call_command(command, stdout=out)