From c89b10ffe4adb1df724b6a7c5c31b42c7dd3376b Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 2 Dec 2009 09:47:02 -0800 Subject: Code style cleanup: dropped some unnecessary =& reference assignments where they're used only out of habit for PHP 4-style object semantics --- lib/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/util.php') diff --git a/lib/util.php b/lib/util.php index 99a0a1db3..ab046e871 100644 --- a/lib/util.php +++ b/lib/util.php @@ -127,7 +127,7 @@ function common_check_user($nickname, $password) if (0 == strcmp(common_munge_password($password, $user->id), $user->password)) { //internal checking passed - $authenticatedUser =& $user; + $authenticatedUser = $user; } } } -- cgit v1.2.3-54-g00ecf From 2ab01e040e224943b1b15131a6e51fe6b5d6e580 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Sat, 5 Dec 2009 02:11:27 -0500 Subject: Add 2 new events to enable logger pluginization: StartLog and EndLog --- EVENTS.txt | 11 +++++++++++ lib/util.php | 25 ++++++++++++++----------- 2 files changed, 25 insertions(+), 11 deletions(-) (limited to 'lib/util.php') diff --git a/EVENTS.txt b/EVENTS.txt index a056aa0a1..e0516f8f4 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -617,3 +617,14 @@ EndInlineScriptElement: After a element is written - $action - $code - $type + +StartLog: Before writing to the logs +- &$priority +- &$msg +- &$filename + +EndLog: After writing to the logs +- $priority +- $msg +- $filename + diff --git a/lib/util.php b/lib/util.php index ab046e871..14d666503 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1070,18 +1070,21 @@ function common_request_id() function common_log($priority, $msg, $filename=null) { - $msg = '[' . common_request_id() . '] ' . $msg; - $logfile = common_config('site', 'logfile'); - if ($logfile) { - $log = fopen($logfile, "a"); - if ($log) { - $output = common_log_line($priority, $msg); - fwrite($log, $output); - fclose($log); + if(Event::handle('StartLog', array(&$priority, &$msg, &$filename))){ + $msg = '[' . common_request_id() . '] ' . $msg; + $logfile = common_config('site', 'logfile'); + if ($logfile) { + $log = fopen($logfile, "a"); + if ($log) { + $output = common_log_line($priority, $msg); + fwrite($log, $output); + fclose($log); + } + } else { + common_ensure_syslog(); + syslog($priority, $msg); } - } else { - common_ensure_syslog(); - syslog($priority, $msg); + Event::handle('EndLog', array($priority, $msg, $filename)); } } -- cgit v1.2.3-54-g00ecf