mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-03-14 08:10:13 +00:00
Simple (example) implementation for logging of basic CalDAV actions.
This commit is contained in:
parent
af9a90328c
commit
5f6e41518e
36
inc/log_caldav_action.php
Normal file
36
inc/log_caldav_action.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Allows logging of CalDAV actions (PUT/DELETE) for possible export or sync
|
||||
* through some other glue.
|
||||
*
|
||||
* @package davical
|
||||
* @category Technical
|
||||
* @subpackage logging
|
||||
* @author Andrew McMillan <andrew@morphoss.com>
|
||||
* @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);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user