aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/5.1.20_drop_help_settings.php
blob: 041837702b425130020ffe6e05ea95b649b34603 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php

class DropHelpSettings extends Migration
{
    public function description()
    {
        return 'Drop unused help system settings';
    }

    public function up()
    {
        $settings = [
            'EXTERNAL_HELP',
            'EXTERNAL_HELP_LOCATIONID',
            'EXTERNAL_HELP_URL',
            'HELP_CONTENT_CURRENT_VERSION'
        ];
        // remove config entries
        $query = 'DELETE `config`, `config_values`
                  FROM `config` LEFT JOIN `config_values` USING (`field`)
                  WHERE `field` IN (?)';
        DBManager::get()->execute($query, [$settings]);
    }

    public function down()
    {
        // create config entries
        $query = 'INSERT INTO `config` (`field`, `value`, `type`, `range`, `section`, `mkdate`, `chdate`, `description`)
                  VALUES (:name, :value, :type, :range, :section, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)';
        $statement = DBManager::get()->prepare($query);
        $statement->execute([
            ':name'        => 'EXTERNAL_HELP',
            ':description' => 'Schaltet das externe Hilfesystem ein',
            ':section'     => '',
            ':range'       => 'global',
            ':type'        => 'boolean',
            ':value'       => '1'
        ]);
        $statement->execute([
            ':name'        => 'EXTERNAL_HELP_LOCATIONID',
            ':description' => 'Eine eindeutige ID zur Identifikation der gewünschten Hilfeseiten, leer bedeutet Standardhilfe',
            ':section'     => '',
            ':range'       => 'global',
            ':type'        => 'string',
            ':value'       => 'default'
        ]);
        $statement->execute([
            ':name'        => 'EXTERNAL_HELP_URL',
            ':description' => 'URL Template für das externe Hilfesystem',
            ':section'     => '',
            ':range'       => 'global',
            ':type'        => 'string',
            ':value'       => 'https://hilfe.studip.de/index.php/%s'
        ]);
        $statement->execute([
            ':name'        => 'HELP_CONTENT_CURRENT_VERSION',
            ':description' => 'Aktuelle Version der Helpbar-Einträge in Stud.IP',
            ':section'     => 'global',
            ':range'       => 'global',
            ':type'        => 'string',
            ':value'       => '3.1'
        ]);
    }
}