aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/log
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/log')
-rw-r--r--phpBB/phpbb/log/dummy.php (renamed from phpBB/phpbb/log/null.php)23
-rw-r--r--phpBB/phpbb/log/log.php378
-rw-r--r--phpBB/phpbb/log/log_interface.php40
3 files changed, 349 insertions, 92 deletions
diff --git a/phpBB/phpbb/log/null.php b/phpBB/phpbb/log/dummy.php
index 77d0fbe2d7..5c2d145e15 100644
--- a/phpBB/phpbb/log/null.php
+++ b/phpBB/phpbb/log/dummy.php
@@ -1,20 +1,22 @@
<?php
/**
*
-* @package phpbb_log
-* @copyright (c) 2013 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
*
*/
namespace phpbb\log;
/**
-* Null logger
-*
-* @package phpbb_log
+* Dummy logger
*/
-class null implements log_interface
+class dummy implements log_interface
{
/**
* {@inheritdoc}
@@ -49,6 +51,13 @@ class null implements log_interface
/**
* {@inheritdoc}
*/
+ public function delete($mode, $conditions = array())
+ {
+ }
+
+ /**
+ * {@inheritdoc}
+ */
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 = '')
{
return array();
diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php
index 62edc6a77f..436c21bdad 100644
--- a/phpBB/phpbb/log/log.php
+++ b/phpBB/phpbb/log/log.php
@@ -1,9 +1,13 @@
<?php
/**
*
-* @package \phpbb\log\log
-* @copyright (c) 2012 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
*
*/
@@ -11,8 +15,6 @@ namespace phpbb\log;
/**
* This class is used to add entries into the log table.
-*
-* @package \phpbb\log\log
*/
class log implements \phpbb\log\log_interface
{
@@ -25,7 +27,7 @@ class log implements \phpbb\log\log_interface
/**
* An array with the disabled log types. Logs of such types will not be
- * added when add_log() is called.
+ * added when add() is called.
* @var array
*/
protected $disabled_types;
@@ -68,7 +70,7 @@ class log implements \phpbb\log\log_interface
/**
* Event dispatcher object
- * @var phpbb_dispatcher
+ * @var \phpbb\event\dispatcher_interface
*/
protected $dispatcher;
@@ -93,15 +95,14 @@ class log implements \phpbb\log\log_interface
/**
* Constructor
*
- * @param \phpbb\db\driver\driver $db Database object
+ * @param \phpbb\db\driver\driver_interface $db Database object
* @param \phpbb\user $user User object
* @param \phpbb\auth\auth $auth Auth object
- * @param phpbb_dispatcher $phpbb_dispatcher Event dispatcher
+ * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher
* @param string $phpbb_root_path Root path
* @param string $relative_admin_path Relative admin root path
* @param string $php_ext PHP Extension
* @param string $log_table Name of the table we use to store our logs
- * @return null
*/
public function __construct($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, $relative_admin_path, $php_ext, $log_table)
{
@@ -157,8 +158,6 @@ class log implements \phpbb\log\log_interface
}
/**
- * This function returns the state of the log system.
- *
* {@inheritDoc}
*/
public function is_enabled($type = '')
@@ -171,12 +170,6 @@ class log implements \phpbb\log\log_interface
}
/**
- * Disable log
- *
- * This function allows disabling the log system or parts of it, for this
- * page call. When add_log is called and the type is disabled,
- * the log will not be added to the database.
- *
* {@inheritDoc}
*/
public function disable($type = '')
@@ -199,10 +192,6 @@ class log implements \phpbb\log\log_interface
}
/**
- * Enable log
- *
- * This function allows re-enabling the log system.
- *
* {@inheritDoc}
*/
public function enable($type = '')
@@ -225,8 +214,6 @@ class log implements \phpbb\log\log_interface
}
/**
- * Adds a log to the database
- *
* {@inheritDoc}
*/
public function add($mode, $user_id, $log_ip, $log_operation, $log_time = false, $additional_data = array())
@@ -236,14 +223,14 @@ class log implements \phpbb\log\log_interface
return false;
}
- if ($log_time == false)
+ if ($log_time === false)
{
$log_time = time();
}
$sql_ary = array(
- 'user_id' => $user_id,
- 'log_ip' => $log_ip,
+ 'user_id' => $user_id ? (int) $user_id : ANONYMOUS,
+ 'log_ip' => empty($log_ip) ? '' : $log_ip,
'log_time' => $log_time,
'log_operation' => $log_operation,
);
@@ -258,14 +245,17 @@ class log implements \phpbb\log\log_interface
break;
case 'mod':
- $forum_id = (int) $additional_data['forum_id'];
+ $forum_id = isset($additional_data['forum_id']) ? (int) $additional_data['forum_id'] : 0;
unset($additional_data['forum_id']);
- $topic_id = (int) $additional_data['topic_id'];
+ $topic_id = isset($additional_data['topic_id']) ? (int) $additional_data['topic_id'] : 0;
unset($additional_data['topic_id']);
+ $post_id = isset($additional_data['post_id']) ? (int) $additional_data['post_id'] : 0;
+ unset($additional_data['post_id']);
$sql_ary += array(
'log_type' => LOG_MOD,
'forum_id' => $forum_id,
'topic_id' => $topic_id,
+ 'post_id' => $post_id,
'log_data' => (!empty($additional_data)) ? serialize($additional_data) : '',
);
break;
@@ -305,10 +295,18 @@ class log implements \phpbb\log\log_interface
* @var array sql_ary Array with log data we insert into the
* database. If sql_ary[log_type] is not set,
* we won't add the entry to the database.
- * @since 3.1-A1
+ * @since 3.1.0-a1
*/
- $vars = array('mode', 'user_id', 'log_ip', 'log_operation', 'log_time', 'additional_data', 'sql_ary');
- extract($this->dispatcher->trigger_event('core.add_log', $vars));
+ $vars = array(
+ 'mode',
+ 'user_id',
+ 'log_ip',
+ 'log_operation',
+ 'log_time',
+ 'additional_data',
+ 'sql_ary',
+ );
+ extract($this->dispatcher->trigger_event('core.add_log', compact($vars)));
// We didn't find a log_type, so we don't save it in the database.
if (!isset($sql_ary['log_type']))
@@ -322,8 +320,99 @@ class log implements \phpbb\log\log_interface
}
/**
- * Grab the logs from the database
- *
+ * {@inheritDoc}
+ */
+ public function delete($mode, $conditions = array())
+ {
+ switch ($mode)
+ {
+ case 'admin':
+ $log_type = LOG_ADMIN;
+ break;
+
+ case 'mod':
+ $log_type = LOG_MOD;
+ break;
+
+ case 'user':
+ $log_type = LOG_USERS;
+ break;
+
+ case 'users':
+ $log_type = LOG_USERS;
+ break;
+
+ case 'critical':
+ $log_type = LOG_CRITICAL;
+ break;
+
+ default:
+ $log_type = false;
+ }
+
+ /**
+ * Allows to modify log data before we delete it from the database
+ *
+ * NOTE: if sql_ary does not contain a log_type value, the entry will
+ * not be deleted in the database. So ensure to set it, if needed.
+ *
+ * @event core.delete_log
+ * @var string mode Mode of the entry we log
+ * @var string log_type Type ID of the log (should be different than false)
+ * @var array conditions An array of conditions, 3 different forms are accepted
+ * 1) <key> => <value> transformed into 'AND <key> = <value>' (value should be an integer)
+ * 2) <key> => array(<operator>, <value>) transformed into 'AND <key> <operator> <value>' (values can't be an array)
+ * 3) <key> => array('IN' => array(<values>)) transformed into 'AND <key> IN <values>'
+ * 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.
+ * @since 3.1.0-b4
+ */
+ $vars = array(
+ 'mode',
+ 'log_type',
+ 'conditions',
+ );
+ extract($this->dispatcher->trigger_event('core.delete_log', compact($vars)));
+
+ if ($log_type === false)
+ {
+ return;
+ }
+
+ $sql_where = 'WHERE log_type = ' . $log_type;
+
+ if (isset($conditions['keywords']))
+ {
+ $sql_where .= $this->generate_sql_keyword($conditions['keywords'], '');
+
+ unset($conditions['keywords']);
+ }
+
+ foreach ($conditions as $field => $field_value)
+ {
+ $sql_where .= ' AND ';
+
+ if (is_array($field_value) && sizeof($field_value) == 2 && !is_array($field_value[1]))
+ {
+ $sql_where .= $field . ' ' . $field_value[0] . ' ' . $field_value[1];
+ }
+ else if (is_array($field_value) && isset($field_value['IN']) && is_array($field_value['IN']))
+ {
+ $sql_where .= $this->db->sql_in_set($field, $field_value['IN']);
+ }
+ else
+ {
+ $sql_where .= $field . ' = ' . $field_value;
+ }
+ }
+
+ $sql = 'DELETE FROM ' . LOG_TABLE . "
+ $sql_where";
+ $this->db->sql_query($sql);
+
+ $this->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_CLEAR_' . strtoupper($mode));
+ }
+
+ /**
* {@inheritDoc}
*/
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 = '')
@@ -403,10 +492,24 @@ class log implements \phpbb\log\log_interface
* is false, no entries will be returned.
* @var string sql_additional Additional conditions for the entries,
* e.g.: 'AND l.forum_id = 1'
- * @since 3.1-A1
+ * @since 3.1.0-a1
*/
- $vars = array('mode', 'count_logs', 'limit', 'offset', 'forum_id', 'topic_id', 'user_id', 'log_time', 'sort_by', 'keywords', 'profile_url', 'log_type', 'sql_additional');
- extract($this->dispatcher->trigger_event('core.get_logs_modify_type', $vars));
+ $vars = array(
+ 'mode',
+ 'count_logs',
+ 'limit',
+ 'offset',
+ 'forum_id',
+ 'topic_id',
+ 'user_id',
+ 'log_time',
+ 'sort_by',
+ 'keywords',
+ 'profile_url',
+ 'log_type',
+ 'sql_additional',
+ );
+ extract($this->dispatcher->trigger_event('core.get_logs_modify_type', compact($vars)));
if ($log_type === false)
{
@@ -421,15 +524,77 @@ class log implements \phpbb\log\log_interface
$sql_keywords = $this->generate_sql_keyword($keywords);
}
- if ($count_logs)
- {
- $sql = 'SELECT COUNT(l.log_id) AS total_entries
- FROM ' . $this->log_table . ' l, ' . USERS_TABLE . ' u
- WHERE l.log_type = ' . (int) $log_type . '
+ $get_logs_sql_ary = array(
+ 'SELECT' => 'l.*, u.username, u.username_clean, u.user_colour',
+ 'FROM' => array(
+ $this->log_table => 'l',
+ USERS_TABLE => 'u',
+ ),
+ 'WHERE' => 'l.log_type = ' . (int) $log_type . "
AND l.user_id = u.user_id
- AND l.log_time >= ' . (int) $log_time . "
$sql_keywords
- $sql_additional";
+ $sql_additional",
+
+ 'ORDER_BY' => $sort_by,
+ );
+
+ if ($log_time)
+ {
+ $get_logs_sql_ary['WHERE'] = 'l.log_time >= ' . (int) $log_time . '
+ AND ' . $get_logs_sql_ary['WHERE'];
+ }
+
+ /**
+ * Modify the query to obtain the logs data
+ *
+ * @event core.get_logs_main_query_before
+ * @var array get_logs_sql_ary The array in the format of the query builder with the query
+ * to get the log count and the log list
+ * @var string mode Mode of the entries we display
+ * @var bool count_logs Do we count all matching entries?
+ * @var int limit Limit the number of entries
+ * @var int offset Offset when fetching the entries
+ * @var mixed forum_id Limit entries to the forum_id,
+ * can also be an array of forum_ids
+ * @var int topic_id Limit entries to the topic_id
+ * @var int user_id Limit entries to the user_id
+ * @var int log_time Limit maximum age of log entries
+ * @var string sort_by SQL order option
+ * @var string keywords Will only return entries that have the
+ * keywords in log_operation or log_data
+ * @var string profile_url URL to the users profile
+ * @var int log_type Limit logs to a certain type. If log_type
+ * is false, no entries will be returned.
+ * @var string sql_additional Additional conditions for the entries,
+ * e.g.: 'AND l.forum_id = 1'
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'get_logs_sql_ary',
+ 'mode',
+ 'count_logs',
+ 'limit',
+ 'offset',
+ 'forum_id',
+ 'topic_id',
+ 'user_id',
+ 'log_time',
+ 'sort_by',
+ 'keywords',
+ 'profile_url',
+ 'log_type',
+ 'sql_additional',
+ );
+ extract($this->dispatcher->trigger_event('core.get_logs_main_query_before', compact($vars)));
+
+ if ($count_logs)
+ {
+ $count_logs_sql_ary = $get_logs_sql_ary;
+
+ $count_logs_sql_ary['SELECT'] = 'COUNT(l.log_id) AS total_entries';
+ unset($count_logs_sql_ary['ORDER_BY']);
+
+ $sql = $this->db->sql_build_query('SELECT', $count_logs_sql_ary);
$result = $this->db->sql_query($sql);
$this->entry_count = (int) $this->db->sql_fetchfield('total_entries');
$this->db->sql_freeresult($result);
@@ -448,14 +613,7 @@ class log implements \phpbb\log\log_interface
}
}
- $sql = 'SELECT l.*, u.username, u.username_clean, u.user_colour
- FROM ' . $this->log_table . ' l, ' . USERS_TABLE . ' u
- WHERE l.log_type = ' . (int) $log_type . '
- AND u.user_id = l.user_id
- ' . (($log_time) ? 'AND l.log_time >= ' . (int) $log_time : '') . "
- $sql_keywords
- $sql_additional
- ORDER BY $sort_by";
+ $sql = $this->db->sql_build_query('SELECT', $get_logs_sql_ary);
$result = $this->db->sql_query_limit($sql, $limit, $this->last_page_offset);
$i = 0;
@@ -488,9 +646,10 @@ class log implements \phpbb\log\log_interface
'time' => (int) $row['log_time'],
'forum_id' => (int) $row['forum_id'],
'topic_id' => (int) $row['topic_id'],
+ 'post_id' => (int) $row['post_id'],
'viewforum' => ($row['forum_id'] && $this->auth->acl_get('f_read', $row['forum_id'])) ? append_sid("{$this->phpbb_root_path}viewforum.{$this->php_ext}", 'f=' . $row['forum_id']) : false,
- 'action' => (isset($this->user->lang[$row['log_operation']])) ? $this->user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}',
+ 'action' => (isset($this->user->lang[$row['log_operation']])) ? $row['log_operation'] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}',
);
/**
@@ -499,10 +658,10 @@ class log implements \phpbb\log\log_interface
* @event core.get_logs_modify_entry_data
* @var array row Entry data from the database
* @var array log_entry_data Entry's data which is returned
- * @since 3.1-A1
+ * @since 3.1.0-a1
*/
$vars = array('row', 'log_entry_data');
- extract($this->dispatcher->trigger_event('core.get_logs_modify_entry_data', $vars));
+ extract($this->dispatcher->trigger_event('core.get_logs_modify_entry_data', compact($vars)));
$log[$i] = $log_entry_data;
@@ -517,12 +676,26 @@ class log implements \phpbb\log\log_interface
// arguments, if there are we fill out the arguments
// array. It doesn't matter if we add more arguments than
// placeholders.
- if ((substr_count($log[$i]['action'], '%') - sizeof($log_data_ary)) > 0)
+ $num_args = 0;
+ if (!is_array($this->user->lang[$row['log_operation']]))
{
- $log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($log[$i]['action'], '%') - sizeof($log_data_ary), ''));
+ $num_args = substr_count($this->user->lang[$row['log_operation']], '%');
+ }
+ else
+ {
+ foreach ($this->user->lang[$row['log_operation']] as $case => $plural_string)
+ {
+ $num_args = max($num_args, substr_count($plural_string, '%'));
+ }
}
- $log[$i]['action'] = vsprintf($log[$i]['action'], $log_data_ary);
+ if (($num_args - sizeof($log_data_ary)) > 0)
+ {
+ $log_data_ary = array_merge($log_data_ary, array_fill(0, $num_args - sizeof($log_data_ary), ''));
+ }
+
+ $lang_arguments = array_merge(array($log[$i]['action']), $log_data_ary);
+ $log[$i]['action'] = call_user_func_array(array($this->user, 'lang'), $lang_arguments);
// If within the admin panel we do not censor text out
if ($this->get_is_admin())
@@ -544,6 +717,10 @@ class log implements \phpbb\log\log_interface
$log[$i]['action'] = make_clickable($log[$i]['action']);
*/
}
+ else
+ {
+ $log[$i]['action'] = $this->user->lang($log[$i]['action']);
+ }
$i++;
}
@@ -558,10 +735,10 @@ class log implements \phpbb\log\log_interface
* get the permission data
* @var array reportee_id_list Array of additional user IDs we
* get the username strings for
- * @since 3.1-A1
+ * @since 3.1.0-a1
*/
$vars = array('log', 'topic_id_list', 'reportee_id_list');
- extract($this->dispatcher->trigger_event('core.get_logs_get_additional_data', $vars));
+ extract($this->dispatcher->trigger_event('core.get_logs_get_additional_data', compact($vars)));
if (sizeof($topic_id_list))
{
@@ -570,6 +747,7 @@ class log implements \phpbb\log\log_interface
foreach ($log as $key => $row)
{
$log[$key]['viewtopic'] = (isset($topic_auth['f_read'][$row['topic_id']])) ? append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . $topic_auth['f_read'][$row['topic_id']] . '&amp;t=' . $row['topic_id']) : false;
+ $log[$key]['viewpost'] = (isset($topic_auth['f_read'][$row['topic_id']]) && $row['post_id']) ? append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . $topic_auth['f_read'][$row['topic_id']] . '&amp;t=' . $row['topic_id'] . '&amp;p=' . $row['post_id']) : false;
$log[$key]['viewlogs'] = (isset($topic_auth['m_'][$row['topic_id']])) ? append_sid("{$this->phpbb_root_path}mcp.{$this->php_ext}", 'i=logs&amp;mode=topic_logs&amp;t=' . $row['topic_id'], true, $this->user->session_id) : false;
}
}
@@ -590,17 +768,63 @@ class log implements \phpbb\log\log_interface
}
}
+ /**
+ * Allow modifying or execute extra final filter on log entries
+ *
+ * @event core.get_logs_after
+ * @var array log Array with all our log entries
+ * @var array topic_id_list Array of topic ids, for which we
+ * get the permission data
+ * @var array reportee_id_list Array of additional user IDs we
+ * get the username strings for
+ * @var string mode Mode of the entries we display
+ * @var bool count_logs Do we count all matching entries?
+ * @var int limit Limit the number of entries
+ * @var int offset Offset when fetching the entries
+ * @var mixed forum_id Limit entries to the forum_id,
+ * can also be an array of forum_ids
+ * @var int topic_id Limit entries to the topic_id
+ * @var int user_id Limit entries to the user_id
+ * @var int log_time Limit maximum age of log entries
+ * @var string sort_by SQL order option
+ * @var string keywords Will only return entries that have the
+ * keywords in log_operation or log_data
+ * @var string profile_url URL to the users profile
+ * @var int log_type The type of logs it was filtered
+ * @since 3.1.3-RC1
+ */
+ $vars = array(
+ 'log',
+ 'topic_id_list',
+ 'reportee_id_list',
+ 'mode',
+ 'count_logs',
+ 'limit',
+ 'offset',
+ 'forum_id',
+ 'topic_id',
+ 'user_id',
+ 'log_time',
+ 'sort_by',
+ 'keywords',
+ 'profile_url',
+ 'log_type',
+ );
+ extract($this->dispatcher->trigger_event('core.get_logs_after', compact($vars)));
+
return $log;
}
/**
* Generates a sql condition for the specified keywords
*
- * @param string $keywords The keywords the user specified to search for
+ * @param string $keywords The keywords the user specified to search for
+ * @param string $table_alias The alias of the logs' table ('l.' by default)
+ * @param string $statement_operator The operator used to prefix the statement ('AND' by default)
*
* @return string Returns the SQL condition searching for the keywords
*/
- protected function generate_sql_keyword($keywords)
+ protected function generate_sql_keyword($keywords, $table_alias = 'l.', $statement_operator = 'AND')
{
// Use no preg_quote for $keywords because this would lead to sole
// backslashes being added. We also use an OR connection here for
@@ -617,7 +841,7 @@ class log implements \phpbb\log\log_interface
for ($i = 0, $num_keywords = sizeof($keywords); $i < $num_keywords; $i++)
{
$keywords_pattern[] = preg_quote($keywords[$i], '#');
- $keywords[$i] = $this->db->sql_like_expression($this->db->any_char . $keywords[$i] . $this->db->any_char);
+ $keywords[$i] = $this->db->sql_like_expression($this->db->get_any_char() . $keywords[$i] . $this->db->get_any_char());
}
$keywords_pattern = '#' . implode('|', $keywords_pattern) . '#ui';
@@ -625,18 +849,32 @@ class log implements \phpbb\log\log_interface
$operations = array();
foreach ($this->user->lang as $key => $value)
{
- if (substr($key, 0, 4) == 'LOG_' && preg_match($keywords_pattern, $value))
+ if (substr($key, 0, 4) == 'LOG_')
{
- $operations[] = $key;
+ if (is_array($value))
+ {
+ foreach ($value as $plural_value)
+ {
+ if (preg_match($keywords_pattern, $plural_value))
+ {
+ $operations[] = $key;
+ break;
+ }
+ }
+ }
+ else if (preg_match($keywords_pattern, $value))
+ {
+ $operations[] = $key;
+ }
}
}
- $sql_keywords = 'AND (';
+ $sql_keywords = ' ' . $statement_operator . ' (';
if (!empty($operations))
{
- $sql_keywords .= $this->db->sql_in_set('l.log_operation', $operations) . ' OR ';
+ $sql_keywords .= $this->db->sql_in_set($table_alias . 'log_operation', $operations) . ' OR ';
}
- $sql_lower = $this->db->sql_lower_text('l.log_data');
+ $sql_lower = $this->db->sql_lower_text($table_alias . 'log_data');
$sql_keywords .= " $sql_lower " . implode(" OR $sql_lower ", $keywords) . ')';
}
@@ -712,8 +950,6 @@ class log implements \phpbb\log\log_interface
}
/**
- * Get total log count
- *
* {@inheritDoc}
*/
public function get_log_count()
@@ -722,8 +958,6 @@ class log implements \phpbb\log\log_interface
}
/**
- * Get offset of the last valid log page
- *
* {@inheritDoc}
*/
public function get_valid_offset()
diff --git a/phpBB/phpbb/log/log_interface.php b/phpBB/phpbb/log/log_interface.php
index 420ba79691..86286e6f88 100644
--- a/phpBB/phpbb/log/log_interface.php
+++ b/phpBB/phpbb/log/log_interface.php
@@ -1,9 +1,13 @@
<?php
/**
*
-* @package \phpbb\log\log
-* @copyright (c) 2012 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
*
*/
@@ -11,8 +15,6 @@ namespace phpbb\log;
/**
* The interface for the log-system.
-*
-* @package \phpbb\log\log
*/
interface log_interface
{
@@ -30,8 +32,8 @@ interface log_interface
* Disable log
*
* This function allows disabling the log system or parts of it, for this
- * page call. When add_log is called and the type is disabled,
- * the log will not be added to the database.
+ * page call. When add() is called and the type is disabled, the log will
+ * not be added to the database.
*
* @param mixed $type The log type we want to disable. Empty to
* disable all logs. Can also be an array of types.
@@ -55,18 +57,30 @@ interface log_interface
/**
* Adds a log entry to the database
*
- * @param string $mode The mode defines which log_type is used and from which log the entry is retrieved
- * @param int $user_id User ID of the user
- * @param string $log_ip IP address of the user
- * @param string $log_operation Name of the operation
- * @param int $log_time Timestamp when the log entry was added, if empty time() will be used
- * @param array $additional_data More arguments can be added, depending on the log_type
+ * @param string $mode The mode defines which log_type is used and from which log the entry is retrieved
+ * @param int $user_id User ID of the user
+ * @param string $log_ip IP address of the user
+ * @param string $log_operation Name of the operation
+ * @param int|bool $log_time Timestamp when the log entry was added. If false, time() will be used
+ * @param array $additional_data More arguments can be added, depending on the log_type
*
* @return int|bool Returns the log_id, if the entry was added to the database, false otherwise.
*/
public function add($mode, $user_id, $log_ip, $log_operation, $log_time = false, $additional_data = array());
/**
+ * Delete entries in the logs
+ *
+ * @param string $mode The mode defines which log_type is used and from which log the entries are deleted
+ * @param array $conditions An array of conditions, 3 different forms are accepted
+ * 1) <key> => <value> transformed into 'AND <key> = <value>' (value should be an integer)
+ * 2) <key> => array(<operator>, <value>) transformed into 'AND <key> <operator> <value>' (values can't be an array)
+ * 3) <key> => array('IN' => array(<values>)) transformed into 'AND <key> IN <values>'
+ * 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.
+ */
+ public function delete($mode, $conditions = array());
+
+ /**
* Grab the logs from the database
*
* @param string $mode The mode defines which log_type is used and ifrom which log the entry is retrieved