Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | /** |
3 | * |
4 | * This file is part of the phpBB Forum Software package. |
5 | * |
6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
7 | * @license GNU General Public License, version 2 (GPL-2.0) |
8 | * |
9 | * For full copyright and license information, please see |
10 | * the docs/CREDITS.txt file. |
11 | * |
12 | */ |
13 | |
14 | namespace phpbb\log; |
15 | |
16 | /** |
17 | * The interface for the log-system. |
18 | */ |
19 | interface log_interface |
20 | { |
21 | /** |
22 | * This function returns the state of the log system. |
23 | * |
24 | * @param string $type The log type we want to check. Empty to get |
25 | * global log status. |
26 | * |
27 | * @return bool True if log for the type is enabled |
28 | */ |
29 | public function is_enabled($type = ''); |
30 | |
31 | /** |
32 | * Disable log |
33 | * |
34 | * This function allows disabling the log system or parts of it, for this |
35 | * page call. When add() is called and the type is disabled, the log will |
36 | * not be added to the database. |
37 | * |
38 | * @param mixed $type The log type we want to disable. Empty to |
39 | * disable all logs. Can also be an array of types. |
40 | * |
41 | * @return null |
42 | */ |
43 | public function disable($type = ''); |
44 | |
45 | /** |
46 | * Enable log |
47 | * |
48 | * This function allows re-enabling the log system. |
49 | * |
50 | * @param mixed $type The log type we want to enable. Empty to |
51 | * enable all logs. Can also be an array of types. |
52 | * |
53 | * @return null |
54 | */ |
55 | public function enable($type = ''); |
56 | |
57 | /** |
58 | * Adds a log entry to the database |
59 | * |
60 | * @param string $mode The mode defines which log_type is used and from which log the entry is retrieved |
61 | * @param int $user_id User ID of the user |
62 | * @param string $log_ip IP address of the user |
63 | * @param string $log_operation Name of the operation |
64 | * @param int|bool $log_time Timestamp when the log entry was added. If false, time() will be used |
65 | * @param array $additional_data More arguments can be added, depending on the log_type |
66 | * |
67 | * @return int|bool Returns the log_id, if the entry was added to the database, false otherwise. |
68 | */ |
69 | public function add($mode, $user_id, $log_ip, $log_operation, $log_time = false, $additional_data = array()); |
70 | |
71 | /** |
72 | * Delete entries in the logs |
73 | * |
74 | * @param string $mode The mode defines which log_type is used and from which log the entries are deleted |
75 | * @param array $conditions An array of conditions, 3 different forms are accepted |
76 | * 1) <key> => <value> transformed into 'AND <key> = <value>' (value should be an integer) |
77 | * 2) <key> => array(<operator>, <value>) transformed into 'AND <key> <operator> <value>' (values can't be an array) |
78 | * 3) <key> => array('IN' => array(<values>)) transformed into 'AND <key> IN <values>' |
79 | * A special field, keywords, can also be defined. In this case only the log entries that have the keywords in log_operation or log_data will be deleted. |
80 | */ |
81 | public function delete($mode, $conditions = array()); |
82 | |
83 | /** |
84 | * Grab the logs from the database |
85 | * |
86 | * @param string $mode The mode defines which log_type is used and ifrom which log the entry is retrieved |
87 | * @param bool $count_logs Shall we count all matching log entries? |
88 | * @param int $limit Limit the number of entries that are returned |
89 | * @param int $offset Offset when fetching the log entries, f.e. when paginating |
90 | * @param mixed $forum_id Restrict the log entries to the given forum_id (can also be an array of forum_ids) |
91 | * @param int $topic_id Restrict the log entries to the given topic_id |
92 | * @param int $user_id Restrict the log entries to the given user_id |
93 | * @param int $log_time Only get log entries newer than the given timestamp |
94 | * @param string $sort_by SQL order option, e.g. 'l.log_time DESC' |
95 | * @param string $keywords Will only return log entries that have the keywords in log_operation or log_data |
96 | * |
97 | * @return array The result array with the logs |
98 | */ |
99 | public function get_logs($mode, $count_logs = true, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $log_time = 0, $sort_by = 'l.log_time DESC', $keywords = ''); |
100 | |
101 | /** |
102 | * Get total log count |
103 | * |
104 | * @return int Returns the number of matching logs from the last call to get_logs() |
105 | */ |
106 | public function get_log_count(); |
107 | |
108 | /** |
109 | * Get offset of the last valid page |
110 | * |
111 | * @return int Returns the offset of the last valid page from the last call to get_logs() |
112 | */ |
113 | public function get_valid_offset(); |
114 | } |