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); +}