clearmapcache --include-history
This commit is contained in:
parent
e7b8e36d8c
commit
4e9f34d4a0
1 changed files with 11 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
@ -6,9 +8,18 @@ from django.utils.translation import ugettext_lazy as _
|
|||
class Command(BaseCommand):
|
||||
help = 'clear the mapdata cache'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('--include-history', action='store_const', const=True, default=False,
|
||||
help=_('incluce all history as well'))
|
||||
|
||||
def handle(self, *args, **options):
|
||||
from c3nav.mapdata.models import MapUpdate
|
||||
MapUpdate.objects.create(type='management')
|
||||
|
||||
if options['include_history']:
|
||||
for file in os.listdir(settings.CACHE_ROOT):
|
||||
if file.startswith('level_'):
|
||||
os.remove(os.path.join(settings.CACHE_ROOT, file))
|
||||
|
||||
if not settings.HAS_REAL_CACHE:
|
||||
print(_('You have no external cache configured, so don\'t forget to restart your c3nav instance!'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue