mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-30 03:24:47 +00:00
Test for IsCollection() before IsBinding() when we are deleting.
This commit is contained in:
parent
05d42557d7
commit
aa05688e4e
@ -48,21 +48,23 @@ if ( ! ( $dav_resource->resource_id() > 0 ) ) {
|
||||
$qry = new AwlQuery();
|
||||
$qry->Begin();
|
||||
|
||||
if ( $dav_resource->IsBinding() ) {
|
||||
$params = array( ':dav_name' => $dav_resource->dav_name() );
|
||||
|
||||
if ( $qry->QDo("DELETE FROM dav_binding WHERE dav_name = :dav_name", $params )
|
||||
&& $qry->Commit() ) {
|
||||
@dbg_error_log( "DELETE", "DELETE: Binding: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path);
|
||||
$request->DoResponse( 204 );
|
||||
if ( $dav_resource->IsCollection() ) {
|
||||
if ( $dav_resource->IsBinding() ) {
|
||||
$params = array( ':dav_name' => $dav_resource->dav_name() );
|
||||
|
||||
if ( $qry->QDo("DELETE FROM dav_binding WHERE dav_name = :dav_name", $params )
|
||||
&& $qry->Commit() ) {
|
||||
@dbg_error_log( "DELETE", "DELETE: Binding: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path);
|
||||
$request->DoResponse( 204 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( $dav_resource->IsCollection() ) {
|
||||
if ( delete_collection( $dav_resource->resource_id() ) && $qry->Commit() ) {
|
||||
// Uncache anything to do with the collection
|
||||
$cache = getCacheInstance();
|
||||
$cache->delete( 'collection-'.$dav_resource->dav_name(), null );
|
||||
$request->DoResponse( 204 );
|
||||
else {
|
||||
if ( delete_collection( $dav_resource->resource_id() ) && $qry->Commit() ) {
|
||||
// Uncache anything to do with the collection
|
||||
$cache = getCacheInstance();
|
||||
$cache->delete( 'collection-'.$dav_resource->dav_name(), null );
|
||||
$request->DoResponse( 204 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@ -8,6 +8,11 @@ Content-Length: 0
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
|
||||
|
||||
dav_etag: >0e091d7cf1ea4f613199a2a60090a7e1<
|
||||
dav_name: >/user4/base/newcalendar/4887b3b0-0f91-012d-1259-002421a2359e.ics<
|
||||
dtstart: >2010-07-17 10:00:00+12<
|
||||
summary: >New Event<
|
||||
|
||||
dav_etag: >228540edb5690f6e8adb855aaa98ee98<
|
||||
dav_name: >/user4/base/newcalendar/73d1f980-ec28-012c-11f9-002421a2359e.ics<
|
||||
dtstart: >2010-01-06 11:00:00+13<
|
||||
@ -33,11 +38,6 @@ Content-Type: text/plain; charset="utf-8"
|
||||
dtstart: >2010-05-03 13:00:00+12<
|
||||
summary: >Youngberg Hill Winemaker Dinner @ The Stephanie Inn<
|
||||
|
||||
dav_etag: >0e091d7cf1ea4f613199a2a60090a7e1<
|
||||
dav_name: >/user4/base/newcalendar/4887b3b0-0f91-012d-1259-002421a2359e.ics<
|
||||
dtstart: >2010-07-17 10:00:00+12<
|
||||
summary: >New Event<
|
||||
|
||||
dav_etag: >a5972f272523b97d6cade1486a8b1c40<
|
||||
dav_name: >/user4/base/newcalendar/ed3beb90-0f8a-012d-1259-002421a2359e.ics<
|
||||
dtstart: >2010-07-18 05:00:00+12<
|
||||
|
||||
@ -55,7 +55,7 @@ target_collection: >11<
|
||||
target_resource_i: >NULL<
|
||||
ticket_owner: >1003<
|
||||
|
||||
bind_id: >1628<
|
||||
bind_id: >1625<
|
||||
bind_owner: >1<
|
||||
bound_source_id: >12<
|
||||
dav_displayname: >user3 home<
|
||||
|
||||
@ -35,7 +35,7 @@ Content-Type: text/plain; charset="utf-8"
|
||||
length: >8<
|
||||
parent_container: >/user4/base/<
|
||||
|
||||
bind_id: >1629<
|
||||
bind_id: >1626<
|
||||
bound_source_id: >1601<
|
||||
dav_displayname: >A normal collection<
|
||||
dav_name: >/user4/boundbase/<
|
||||
|
||||
@ -112,7 +112,7 @@
|
||||
<prop>
|
||||
<displayname>newcalendar</displayname>
|
||||
<resource-id>
|
||||
<href>/caldav.php/.resources/1618</href>
|
||||
<href>/caldav.php/.resources/1615</href>
|
||||
</resource-id>
|
||||
<parent-set>
|
||||
<parent>
|
||||
|
||||
@ -125,7 +125,7 @@
|
||||
<prop>
|
||||
<displayname>newcalendar</displayname>
|
||||
<resource-id>
|
||||
<href>/caldav.php/.resources/1618</href>
|
||||
<href>/caldav.php/.resources/1615</href>
|
||||
</resource-id>
|
||||
<parent-set>
|
||||
<parent>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
setval
|
||||
--------
|
||||
1629
|
||||
1626
|
||||
(1 row)
|
||||
|
||||
setval
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
setval
|
||||
--------
|
||||
1641
|
||||
1638
|
||||
(1 row)
|
||||
|
||||
setval
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user