Its very simple actually. Make directory caled "misagositemaps", put
__init__.py in it. Put directory into it, name it
__init__.py in it. Finally inside that dir make
commands directory. There make empty
__init__.py and non-empty
Writing manage.py commands is documented here. Here are example commands defined by Django, and here is command Misago uses to prune forums of old threads.
For memory-safe iteration over threads, this command imports
misago.models.Forum model and runs following:
for forum in Forum.objects.iterator():
for thread in forum.thread_set.all().iterator():
# Thiss wont load all threads to memory and won't crash when you have many threads.
Other issue I've spotted is that it includes private threads, reports as well as threads made in private forums in sitemap. However I admit that in lack of real documentation for 0.5 APIs, its going to be tricky to get it done "right" from nothing.
So for starters add extra query to pull out
rght fields of forum with
special="root". Then run second query pulling out ID's on forums that have
lft greater than root's one and
rght smaller than root's one. Those ID's will belong to forums.