aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.52_additional_semtree_log_actions.php
blob: 23e81fa91a41256c34ca0e418e14b6b3a64b5704 (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 AdditionalSemtreeLogActions extends Migration {

    // Array of new Log Actions
    private $logactions = [
        [
            'name'=>'STUDYAREA_ADD',
            'description'=>'Studienbereich hinzufügen',
            'info_template'=>'%user legt Studienbereich %studyarea(%affected) an.',
            'active'=>0],
        [
            'name'=>'STUDYAREA_DELETE',
            'description'=>'Studienbereich löschen',
            'info_template'=>'%user entfernt Studienbereich %studyarea(%affected).',
            'active'=>0]
            ];


    function description () {
        return 'adds two new log actions for adding and deleting SemTree Items';
    }

    function up () {

        $insert = "INSERT IGNORE INTO `log_actions` (`action_id`, `name`, `description`, `info_template`, `active`, `expires`) VALUES( MD5('%s'), '%s', '%s', '%s', %s, NULL)";

        foreach ($this->logactions as $a)
        {
            DBManager::get()->query(sprintf($insert,$a['name'],$a['name'],$a['description'],$a['info_template'],$a['active']));
        }
    }

    function down () {

        $delete = "DELETE FROM log_actions WHERE action_id = MD5('%s')";

        foreach ($this->logactions as $a)
        {
            DBManager::get()->query(sprintf($delete,$a['name']));
        }
    }
}



?>