diff --git a/inc/caldav-DELETE.php b/inc/caldav-DELETE.php index 1029816f..db1be0bf 100644 --- a/inc/caldav-DELETE.php +++ b/inc/caldav-DELETE.php @@ -84,12 +84,18 @@ else { if ( $qry->QDo("SELECT write_sync_change(collection_id, 404, caldav_data.dav_name) FROM caldav_data WHERE dav_id = :dav_id", $params ) && $qry->QDo("DELETE FROM property WHERE dav_name = (SELECT dav_name FROM caldav_data WHERE dav_id = :dav_id)", $params ) && $qry->QDo("DELETE FROM locks WHERE dav_name = (SELECT dav_name FROM caldav_data WHERE dav_id = :dav_id)", $params ) - && $qry->QDo("DELETE FROM caldav_data WHERE dav_id = :dav_id", $params ) - && $qry->Commit() ) { + && $qry->QDo("DELETE FROM caldav_data WHERE dav_id = :dav_id", $params ) ) { + if ( function_exists('log_caldav_action') ) { + log_caldav_action( 'DELETE', $dav_resource->GetProperty('uid'), $dav_resource->GetProperty('user_no'), $dav_resource->GetProperty('collection_id'), $request->path ); + } + + $qry->Commit(); @dbg_error_log( "DELETE", "DELETE: User: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path); - if ( function_exists('log_caldav_action') ) { - log_caldav_action( 'DELETE', $dav_resource->GetProperty('uid'), $dav_resource->GetProperty('user_no'), $dav_resource->GetProperty('collection_id'), $request->path ); + + if ( function_exists('post_commit_action') ) { + post_commit_action( 'DELETE', $dav_resource->GetProperty('uid'), $dav_resource->GetProperty('user_no'), $dav_resource->GetProperty('collection_id'), $request->path ); } + $cache->delete( 'collection-'.$dav_resource->parent_path(), null ); $cache->releaseLock($myLock); $request->DoResponse( 204 ); diff --git a/inc/caldav-PUT-functions.php b/inc/caldav-PUT-functions.php index fb7cebe7..3e824695 100644 --- a/inc/caldav-PUT-functions.php +++ b/inc/caldav-PUT-functions.php @@ -1358,6 +1358,10 @@ EOSQL; $qry->QDo("SELECT write_sync_change( $collection_id, $sync_change, :dav_name)", array(':dav_name' => $path ) ); $qry->Commit(); + if ( function_exists('post_commit_action') ) { + post_commit_action( $put_action_type, $first->GetPValue('UID'), $user_no, $collection_id, $path ); + } + // Uncache anything to do with the collection $cache = getCacheInstance(); $cache_ns = 'collection-'.preg_replace( '{/[^/]*$}', '/', $path);