aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.237_config_mail_subject.php
blob: e02af5adfe97dafd185a2638a4f753753801aa1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
class ConfigMailSubject extends Migration
{
    public function description()
    {
        return 'add config options for MAIL_USE_SUBJECT_PREFIX and NOTIFY_ON_WAITLIST_ADVANCE';
    }

    public function up()
    {
        $db = DBManager::get();

        $stmt = $db->prepare('INSERT INTO config (field, value, type, section, mkdate, chdate, description)
                              VALUES (:name, :value, :type, :section, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)');
        $stmt->execute([
            'name'        => 'MAIL_USE_SUBJECT_PREFIX',
            'description' => 'Stellt dem Titel von per Mail versandten Nachrichten den Wert von UNI_NAME_CLEAN voran.',
            'section'     => 'global',
            'type'        => 'boolean',
            'value'       => '1'
        ]);
        $stmt->execute([
            'name'        => 'NOTIFY_ON_WAITLIST_ADVANCE',
            'description' => 'Versendet Nachrichten an Teilnehmer bei jeder Änderung der Position auf der Warteliste',
            'section'     => 'global',
            'type'        => 'boolean',
            'value'       => '1'
        ]);
    }

    public function down()
    {
        $db = DBManager::get();

        $stmt = $db->prepare('DELETE config, config_values FROM config LEFT JOIN config_values USING(field) WHERE field = ?');
        $stmt->execute(['MAIL_USE_SUBJECT_PREFIX']);
        $stmt->execute(['NOTIFY_ON_WAITLIST_ADVANCE']);
    }
}