From 5f6e41518ecfee03666b48cddfe6f37aea20df88 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 24 Aug 2009 13:44:53 +1200 Subject: [PATCH] Simple (example) implementation for logging of basic CalDAV actions. --- inc/log_caldav_action.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 inc/log_caldav_action.php diff --git a/inc/log_caldav_action.php b/inc/log_caldav_action.php new file mode 100644 index 00000000..9c55a159 --- /dev/null +++ b/inc/log_caldav_action.php @@ -0,0 +1,36 @@ + +* @copyright Morphoss Ltd +* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 +*/ + +/** +* Log the action +* @param string $action_type INSERT / UPDATE or DELETE +* @param string $uid The UID of the modified item +* @param integer $user_no The user owning the containing collection. +* @param integer $collection_id The ID of the containing collection. +* @param string $dav_name The DAV path of the item, relative to the DAViCal base path +*/ +function log_caldav_action( $action_type, $uid, $user_no, $collection_id, $dav_name ) { + global $c; + + $logline = sprintf( '%s %s %s %s %s %s', gmdate('Ymd"T"HMS"Z"'), $action_type, $uid, $user_no, $collection_id, $dav_name ); + if ( !isset($c->action_log_name) ) { + error_log( $logline ); + return; + } + + $logline .= "\n"; + + $logfile = fopen( $c->action_log_name, "a+" ); + fwrite( $logfile, $logline ); + fclose($logfile); +}