mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-17 09:46:08 +01: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()
|
||||
|
||||
Reference in New Issue
Block a user