1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* DataWriter for temporare action log. |
4
|
|
|
* |
5
|
|
|
* @package ThreemaGateway |
6
|
|
|
* @author rugk |
7
|
|
|
* @copyright Copyright (c) 2017 rugk |
8
|
|
|
* @license MIT |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
class ThreemaGateway_DataWriter_ActionThrottle extends XenForo_DataWriter |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* Gets the fields that are defined for the table. See parent for explanation. |
15
|
|
|
* |
16
|
|
|
* @see XenForo_DataWriter::_getFields() |
17
|
|
|
* @return array |
18
|
|
|
*/ |
19
|
|
|
protected function _getFields() |
20
|
|
|
{ |
21
|
|
|
return [ |
22
|
|
|
ThreemaGateway_Model_ActionThrottle::DB_TABLE => [ |
23
|
|
|
'action_id' => [ |
24
|
|
|
'type' => self::TYPE_UINT, |
25
|
|
|
'autoIncrement' => true |
26
|
|
|
], |
27
|
|
|
'user_id' => [ |
28
|
|
|
'type' => self::TYPE_UINT, |
29
|
|
|
'required' => true |
30
|
|
|
], |
31
|
|
|
'action_date' => [ |
32
|
|
|
'type' => self::TYPE_UINT, |
33
|
|
|
'required' => true |
34
|
|
|
], |
35
|
|
|
'action_type' => [ |
36
|
|
|
'type' => self::TYPE_STRING, |
37
|
|
|
'required' => true, |
38
|
|
|
'maxLength' => 25 |
39
|
|
|
], |
40
|
|
|
] |
41
|
|
|
]; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Gets the actual existing data out of data that was passed in. See parent for explanation. |
46
|
|
|
* |
47
|
|
|
* As an update cannot happen in the table anyway, this function is not |
48
|
|
|
* implemented in any way. |
49
|
|
|
* |
50
|
|
|
* @param mixed $data |
51
|
|
|
* @see XenForo_DataWriter::_getExistingData() |
52
|
|
|
* @return array |
53
|
|
|
*/ |
54
|
|
|
protected function _getExistingData($data) |
55
|
|
|
{ |
56
|
|
|
return []; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Gets SQL condition to update the existing record. |
61
|
|
|
* |
62
|
|
|
* As an update cannot happen in the table anyway, this function is not |
63
|
|
|
* implemented in any way. |
64
|
|
|
* |
65
|
|
|
* @param string $tableName |
66
|
|
|
* @see XenForo_DataWriter::_getUpdateCondition() |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
|
|
protected function _getUpdateCondition($tableName) |
70
|
|
|
{ |
71
|
|
|
return ''; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Get the action throttle model. |
77
|
|
|
* |
78
|
|
|
* @return ThreemaGateway_Model_ActionThrottle |
79
|
|
|
*/ |
80
|
|
|
protected function _getActionThrottleModel() |
81
|
|
|
{ |
82
|
|
|
return $this->getModelFromCache('ThreemaGateway_Model_ActionThrottle'); |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|