aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/5.4.13_add_unlock_action.php
blob: d3834a12d4177cf9d1e19985de5e8995c660b9e7 (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
<?php

final class AddUnlockAction extends Migration
{
    public function description()
    {
        return 'add an unlock action';
    }

    public function up()
    {
        DBManager::get()->exec("
            INSERT IGNORE INTO `log_actions`
            SET `action_id` = MD5('USER_UNLOCK'),
                `name` = 'USER_UNLOCK',
                `description` = 'Nutzer wird entsperrt',
                `info_template` = '%user entsperrt %user(%affected) (%info)',
                `active` = '1',
                `expires` = '0'
        ");
    }

    public function down()
    {
        $actions = ['USER_UNLOCK'];

        DBManager::get()->execute(
            "DELETE `log_events` FROM `log_events` JOIN `log_actions` USING (`action_id`) WHERE `name` IN (?)",
            [$actions]
        );
        DBManager::get()->execute("DELETE FROM `log_actions` WHERE `name` IN (?)", [$actions]);
    }
}