Overview

Packages

  • awl
    • caldav-client-v2
    • RRule
  • davical
    • authentication
      • drivers
    • caldav
    • DAViCalSession
    • DAVTicket
    • external-bind
    • feed
    • HTTPAuthSession
    • iSchedule
    • iSchedule-POST
    • logging
    • metrics
    • Principal
    • propfind
    • PublicSession
    • Request
    • Resource
    • tzservice
  • None
  • PHP

Functions

  • log_caldav_action
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
 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: */
26: function 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: }
41: 
DAViCal API documentation generated by ApiGen 2.8.0