source: contrib/davical/inc/log_caldav_action.php @ 3733

Revision 3733, 1.3 KB checked in by gabriel.malheiros, 13 years ago (diff)

Ticket #1541 - <Davical customizado para o Expresso.Utiliza Caldav e CardDav?>

Line 
1<?php
2/**
3* Allows logging of CalDAV actions (PUT/DELETE) for possible export or sync
4* through some other glue.
5*
6* @package   davical
7* @category Technical
8* @subpackage   logging
9* @author    Andrew McMillan <andrew@morphoss.com>
10* @copyright Morphoss Ltd
11* @license   http://gnu.org/copyleft/gpl.html GNU GPL v2
12*
13* This file is intended to be used as a template, perhaps the user of this service
14* will want to log actions in a very different manner and this can be used as an
15* example of how to go about doing that.
16*/
17
18/**
19* Log the action
20* @param string $action_type INSERT / UPDATE or DELETE
21* @param string $uid The UID of the modified item
22* @param integer $user_no The user owning the containing collection.
23* @param integer $collection_id The ID of the containing collection.
24* @param string $dav_name The DAV path of the item, relative to the DAViCal base path
25*/
26function log_caldav_action( $action_type, $uid, $user_no, $collection_id, $dav_name ) {
27  global $c;
28
29  $logline = sprintf( '%s %s %s %s %s %s', gmdate('Ymd\THis\Z'), $action_type, $uid, $user_no, $collection_id, $dav_name );
30  if ( !isset($c->action_log_name) ) {
31    error_log( $logline );
32    return;
33  }
34
35  $logline .= "\n";
36
37  $logfile = fopen( $c->action_log_name, "a+" );
38  fwrite( $logfile, $logline );
39  fclose($logfile);
40}
Note: See TracBrowser for help on using the repository browser.