aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.66_config_filesystem_multicopy_enable.php
blob: e721fb5ae671de6872053854f30780073db26978 (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
<?php

class ConfigFilesystemMulticopyEnable extends Migration {

    function description() {
        return 'Inserts a new config-variable to enable or disable multicopy for teachers.';
    }

    function up() {
        $options[] =
            [
            'name'        => 'FILESYSTEM_MULTICOPY_ENABLE',
            'type'        => 'boolean',
            'value'       => 1,
            'section'     => '',
            'description' => 'Soll es erlaubt sein, das Dozenten Ordner oder Dateien in mehrere Veranstaltungen bzw. Institute verschieben oder kopieren dürfen?'
            ];

        $stmt = DBManager::get()->prepare("
                INSERT IGNORE INTO config
                    (config_id, field, value, is_default, type, section, mkdate, chdate, description)
                VALUES
                    (MD5(:name), :name, :value, 1, :type, :section, UNIX_TIMESTAMP(),  UNIX_TIMESTAMP(), :description)
                ");

        foreach ($options as $option) {
            $stmt->execute($option);
        }
    }

    function down() {
        $db = DBManager::get()->exec("DELETE FROM config WHERE field = 'FILESYSTEM_MULTICOPY_ENABLE'");
    }
}