Completed
Push — master ( 2a5b9e...5fec60 )
by rugk
02:33
created

ThreemaGateway_Installer_ActionThrottle   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 1
A destroy() 0 5 1
1
<?php
2
/**
3
 * Adds/Deletes the action throttle table.
4
 *
5
 * @package ThreemaGateway
6
 * @author rugk
7
 * @copyright Copyright (c) 2017 rugk
8
 * @license MIT
9
 */
10
11
/**
12
 * Methods for creating or deleting the action throttle table.
13
 */
14
class ThreemaGateway_Installer_ActionThrottle
15
{
16
    /**
17
     * @var string database table name
18
     */
19
    const DB_TABLE = 'xf_threemagw_action_throttle';
20
21
    /**
22
     * Create a new table in the database.
23
     */
24
    public function create()
25
    {
26
        $db = XenForo_Application::get('db');
27
        $db->query('CREATE TABLE `' . self::DB_TABLE . '`
28
            (`action_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
29
            `user_id` INT(10) UNSIGNED NOT NULL,
30
            `action_date` INT(10) UNSIGNED NOT NULL,
31
            `action_type` VARBINARY(25) NOT NULL,
32
            PRIMARY KEY(`action_id`)
33
            ) COMMENT=\'Temporarily logs Threema Gateway actions of users in order to limit them.\'');
34
    }
35
36
    /**
37
     * Deletes the table.
38
     */
39
    public function destroy()
40
    {
41
        $db = XenForo_Application::get('db');
42
        $db->query('DROP TABLE `' . self::DB_TABLE . '`');
43
    }
44
}
45