diff --git a/src/core/management/commands/housekeeping.py b/src/core/management/commands/housekeeping.py index b9b5c9bf2a48845c52d84283e5080af7111efe35..90e081ff6966469969c9eee4cf36e8d3bb80e0dc 100644 --- a/src/core/management/commands/housekeeping.py +++ b/src/core/management/commands/housekeeping.py @@ -4,6 +4,7 @@ from django.core.management.base import BaseCommand, CommandError from django.db.models import Max from django.utils import timezone +from ...models import StaticPageNamespace from ...models.conference import Conference, ConferenceExportCache from ...models.messages import DirectMessage from ...models.schedules import ScheduleSource, ScheduleSourceImport @@ -20,6 +21,7 @@ class Command(BaseCommand): self._housekeeping_vouchers() self._housekeeping_scheduleimports() self._housekeeping_exportcache() + self._housekeeping_wikimports() def _housekeeping_directmessages(self): # clear all direct messages which are after their expiry date @@ -99,6 +101,12 @@ class Command(BaseCommand): print('Flagged', changed, 'out of', total, 'cached exports for regeneration.') + def _housekeeping_wikimports(self): + for c in Conference.objects.all(): + for ns in StaticPageNamespace.objects.filter(conference=c).exclude(upstream_url__isnull=True).all(): + print(f'Importing "{c.slug}" wiki namespace "{ns.prefix}" ...') + ns.fetch_upstream() + def handle(self, *args, **options): # call _do_housekeeping repeatedly (unless --forever is not set) forever = options.get('forever')