mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
@@ -6,6 +6,7 @@ database.
|
||||
"""
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import connection
|
||||
|
||||
from modoboa.core.models import Extension
|
||||
|
||||
@@ -22,3 +23,4 @@ class Command(BaseCommand):
|
||||
fullname = "modoboa.extensions.{0}".format(extension.name)
|
||||
if not fullname in settings.MODOBOA_APPS:
|
||||
extension.delete()
|
||||
connection.close()
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
import datetime
|
||||
from optparse import make_option
|
||||
from django import db
|
||||
|
||||
from django.db import connection
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import timezone
|
||||
|
||||
from modoboa.core import load_core_settings
|
||||
from modoboa.core.models import Log
|
||||
from modoboa.lib import parameters
|
||||
@@ -43,5 +45,5 @@ class Command(BaseCommand):
|
||||
self.__vprint("Deleting logs older than %d days..." % log_maximum_age)
|
||||
limit = timezone.now() - datetime.timedelta(log_maximum_age)
|
||||
Log.objects.filter(date_created__lt=limit).delete()
|
||||
db.close_connection()
|
||||
connection.close()
|
||||
self.__vprint("Done.")
|
||||
|
||||
@@ -6,6 +6,7 @@ from optparse import make_option
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import connection
|
||||
|
||||
from modoboa.core.models import Extension
|
||||
|
||||
@@ -55,3 +56,5 @@ class Command(BaseCommand):
|
||||
if not fullname in settings.MODOBOA_APPS:
|
||||
continue
|
||||
self._change_extension_state(extname, options)
|
||||
|
||||
connection.close()
|
||||
|
||||
@@ -6,6 +6,7 @@ See `https://docs.djangoproject.com/en/dev/ref/contrib/sites/`_.
|
||||
"""
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.db import connection
|
||||
|
||||
from django.contrib.sites.models import Site
|
||||
|
||||
@@ -24,3 +25,4 @@ class Command(BaseCommand):
|
||||
site.domain = args[0]
|
||||
site.name = args[0]
|
||||
site.save()
|
||||
connection.close()
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import os
|
||||
|
||||
import logging
|
||||
from optparse import make_option
|
||||
from django import db
|
||||
import os
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import connection
|
||||
|
||||
from modoboa.lib import parameters
|
||||
from modoboa.lib.sysutils import exec_cmd
|
||||
from modoboa.lib.exceptions import InternalError
|
||||
@@ -91,4 +94,4 @@ class Command(BaseCommand):
|
||||
self.logger.info('%s succeed', ope)
|
||||
ope.delete()
|
||||
os.unlink(options['pidfile'])
|
||||
db.close_connection()
|
||||
connection.close()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# coding: utf-8
|
||||
from optparse import make_option
|
||||
|
||||
from django import db
|
||||
from django.db import connection
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.template.loader import render_to_string
|
||||
from django.core.urlresolvers import reverse
|
||||
@@ -94,4 +94,4 @@ class Command(BaseCommand):
|
||||
continue
|
||||
rcpt = su.mailbox_set.all()[0].full_address
|
||||
self.send_pr_notification(rcpt, reqs)
|
||||
db.close_connection()
|
||||
connection.close()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import time
|
||||
from optparse import make_option
|
||||
from django import db
|
||||
from django.db import connection
|
||||
from django.core.management.base import BaseCommand
|
||||
from modoboa.lib import parameters
|
||||
from modoboa.extensions.amavis import Amavis
|
||||
@@ -64,6 +64,6 @@ class Command(BaseCommand):
|
||||
for maddr in Maddr.objects.all():
|
||||
if not maddr.msgs_set.count() and not maddr.msgrcpt_set.count():
|
||||
maddr.delete()
|
||||
db.close_connection()
|
||||
connection.close()
|
||||
|
||||
self.__vprint("Done.")
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
# coding: utf-8
|
||||
import sys
|
||||
import datetime
|
||||
from django import db
|
||||
|
||||
from django.db import connection
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.utils import timezone
|
||||
|
||||
from modoboa.lib import parameters
|
||||
from modoboa.lib.emailutils import split_mailbox, sendmail_simple
|
||||
from modoboa.extensions.admin.models import Mailbox
|
||||
@@ -65,4 +67,4 @@ class Command(BaseCommand):
|
||||
continue
|
||||
|
||||
send_autoreply(sender, mbox, armessage)
|
||||
db.close_connection()
|
||||
connection.close()
|
||||
|
||||
@@ -25,7 +25,7 @@ import rrdtool
|
||||
import string
|
||||
from optparse import make_option
|
||||
|
||||
from django import db
|
||||
from django.db import connection
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from modoboa.core.extensions import exts_pool
|
||||
@@ -372,4 +372,4 @@ class Command(BaseCommand):
|
||||
options["logfile"] = parameters.get_admin("LOGFILE", app="stats")
|
||||
p = LogParser(options, parameters.get_admin("RRD_ROOTDIR", app="stats"))
|
||||
p.process()
|
||||
db.close_connection()
|
||||
connection.close()
|
||||
|
||||
Reference in New Issue
Block a user