aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/5.3.2_remove_oer_title.php
blob: 2df3e964870d29af458c2bc33a211d1e0b313b2b (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
<?php


class RemoveOerTitle extends Migration
{
    public function description()
    {
        return 'Removes the option OER_TITLE from the config';
    }


    public function up()
    {
        DBManager::get()->exec(
            "DELETE FROM `config_values`
            WHERE `field` = 'OER_TITLE'"
        );
        DBManager::get()->exec(
            "DELETE FROM `config`
            WHERE `field` = 'OER_TITLE'"
        );
    }


    public function down()
    {
        $query = "INSERT INTO `config`
                  SET `field` = :field,
                      `value` = :value,
                      `type` = :type,
                      `range` = :range,
                      `section` = :section,
                      `mkdate` = UNIX_TIMESTAMP(),
                      `chdate` = UNIX_TIMESTAMP(),
                      `description` = :description";
        $config_statement = DBManager::get()->prepare($query);
        $config_statement->execute([
            ':field'       => 'OER_TITLE',
            ':value'       => 'OER Campus',
            ':type'        => 'string',
            ':range'       => 'global',
            ':section'     => 'OERCampus',
            ':description' => 'Name des OER Campus in Stud.IP',
        ]);
    }
}