aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-08-21 12:40:55 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-08-21 12:40:55 +0200
commit0fcbb40a0e1affcfa07a6d51ce273b73b3a95359 (patch)
tree2385dbc5393ebb1507cd27d2394b3c63437e2c17 /phpBB/includes
parent3170845a5011ea76af7f4f8359acafb43ad7e19e (diff)
downloadforums-0fcbb40a0e1affcfa07a6d51ce273b73b3a95359.tar
forums-0fcbb40a0e1affcfa07a6d51ce273b73b3a95359.tar.gz
forums-0fcbb40a0e1affcfa07a6d51ce273b73b3a95359.tar.bz2
forums-0fcbb40a0e1affcfa07a6d51ce273b73b3a95359.tar.xz
forums-0fcbb40a0e1affcfa07a6d51ce273b73b3a95359.zip
[ticket/10714] Enable core.add_log event and remove superseded add_log_case
PHPBB3-10714
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/log/log.php46
1 files changed, 22 insertions, 24 deletions
diff --git a/phpBB/includes/log/log.php b/phpBB/includes/log/log.php
index 5d81dd8495..752ed21955 100644
--- a/phpBB/includes/log/log.php
+++ b/phpBB/includes/log/log.php
@@ -134,12 +134,7 @@ class phpbb_log implements phpbb_log_interface
return false;
}
- global $db;
- /**
- * @todo: enable when events are merged
- *
global $db, $phpbb_dispatcher;
- */
if ($log_time == false)
{
@@ -192,34 +187,37 @@ class phpbb_log implements phpbb_log_interface
'log_data' => (!empty($additional_data)) ? serialize($additional_data) : '',
);
break;
-
- default:
- /**
- * @todo: enable when events are merged
- *
- if ($phpbb_dispatcher != null)
- {
- $vars = array('mode', 'user_id', 'log_ip', 'log_operation', 'log_time', 'additional_data', 'sql_ary');
- extract($phpbb_dispatcher->trigger_event('core.add_log_case', $vars, $vars));
- }
- */
-
- // We didn't find a log_type, so we don't save it in the database.
- if (!isset($sql_ary['log_type']))
- {
- return false;
- }
}
/**
- * @todo: enable when events are merged
+ * Allow to modify log data before we add them to the database
+ *
+ * NOTE: if sql_ary does not contain a log_type value, the entry will
+ * not be stored in the database. So ensure to set it, if needed.
*
+ * @event core.add_log
+ * @var string mode Mode of the entry we log
+ * @var int user_id ID of the user who triggered the log
+ * @var string log_ip IP of the user who triggered the log
+ * @var string log_operation Language key of the log operation
+ * @var int log_time Timestamp, when the log was added
+ * @var array additional_data Array with additional log data
+ * @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
+ */
if ($phpbb_dispatcher != null)
{
$vars = array('mode', 'user_id', 'log_ip', 'log_operation', 'log_time', 'additional_data', 'sql_ary');
extract($phpbb_dispatcher->trigger_event('core.add_log', $vars, $vars));
}
- */
+
+ // We didn't find a log_type, so we don't save it in the database.
+ if (!isset($sql_ary['log_type']))
+ {
+ return false;
+ }
$db->sql_query('INSERT INTO ' . $this->log_table . ' ' . $db->sql_build_array('INSERT', $sql_ary));