mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-20 06:08:35 +02:00
A little script to simplify migration from 0.5 to 0.6
This commit is contained in:
@@ -43,6 +43,12 @@ current installation. Once done, go to MailNG repository and run::
|
||||
|
||||
You must also modify 'settings.py' in order to activate new components.
|
||||
|
||||
If you plan to use the 'Postfix autoreply' extension, you'll need to run
|
||||
the following script to make it work correctly::
|
||||
|
||||
export PYTHONPATH=$PWD/..
|
||||
DJANGO_SETTINGS_MODULE=mailng.settings ./scripts/upgrade_autoreply.py
|
||||
|
||||
Host configuration
|
||||
------------------
|
||||
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from django.conf import settings
|
||||
from mailng.admin.models import Domain, Mailbox
|
||||
|
||||
if __name__ == "__main__":
|
||||
if "mailng.extensions.postfix_autoreply" in settings.INSTALLED_APPS:
|
||||
import mailng.extensions.postfix_autoreply.main as par
|
||||
from mailng.extensions.postfix_autoreply.models import Transport, Alias
|
||||
|
||||
doms = Domain.objects.all()
|
||||
for dom in doms:
|
||||
try:
|
||||
trans = Transport.objects.get(domain="autoreply.%s" % dom.name)
|
||||
continue
|
||||
except Transport.DoesNotExist:
|
||||
par.onCreateDomain(dom=dom)
|
||||
mboxes = Mailbox.objects.filter(domain=dom.id)
|
||||
for mb in mboxes:
|
||||
try:
|
||||
alias = Alias.objects.get(full_address=mb.full_address)
|
||||
continue
|
||||
except Alias.DoesNotExist:
|
||||
par.onCreateMailbox(mbox=mb)
|
||||
|
||||
Reference in New Issue
Block a user