bgneal@395: """
bgneal@395: update_forum_stats.py - A management command to calculate and update the
bgneal@395: cache with the forum statistics. These are done out of the request /
bgneal@395: response cycle because doing a count on the Post table is expensive
bgneal@395: under MySQL and InnoDb.
bgneal@395: 
bgneal@395: """
bgneal@395: from django.core.management.base import NoArgsCommand, CommandError
bgneal@395: 
bgneal@395: from forums.stats import update_stats
bgneal@395: 
bgneal@395: 
bgneal@395: class Command(NoArgsCommand):
bgneal@395:     help = "Calculates and updates the cache with forums statistics"
bgneal@395: 
bgneal@395:     def handle_noargs(self, **opts):
bgneal@395:         update_stats()