aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.80_skiplinks_enable_configuration.php
blob: 5d022e50f8dcfffdf2f7e435448a54b8eac906cc (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
40
41
42
43
44
45
46
47
<?php

class SkiplinksEnableConfiguration extends Migration
{
    /**
     * short description of this migration
     */
    function description()
    {
        return 'adds a configuration for enabling skip links';
    }

    /**
     * perform this migration
     */
    function up()
    {
        $options[] =
            [
            'name'        => 'SKIPLINKS_ENABLE',
            'type'        => 'boolean',
            'value'       => '',
            'range'       => 'user',
            'section'     => 'privacy',
            'description' => 'Wählen Sie diese Option, um Skiplinks beim ersten Drücken der Tab-Taste anzuzeigen (Systemdefault).'
            ];

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

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

    /**
     * revert this migration
     */
    function down()
    {
        $db = DBManager::get()->exec("DELETE FROM config WHERE field = 'SKIPLINKS_ENABLE'");
    }
}