From 612ac73a3055aac52c28e2fe6e80a11f1bde8934 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 7 Dec 2011 14:53:26 +1300 Subject: [PATCH] Try to short-circuit so we only do expansion if we know we need it. --- inc/caldav-REPORT-calquery.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inc/caldav-REPORT-calquery.php b/inc/caldav-REPORT-calquery.php index eda04f9d..5c01caea 100644 --- a/inc/caldav-REPORT-calquery.php +++ b/inc/caldav-REPORT-calquery.php @@ -341,7 +341,11 @@ if ( $qry->Exec("calquery",__LINE__,__FILE__) && $qry->rows() > 0 ) { } if ( $need_expansion ) { $vResource = new vComponent($dav_object->caldav_data); + $expanded = getVCalendarRange($vResource); + if ( !$expanded->overlaps($range_filter) ) continue; + $expanded = expand_event_instances($vResource, $expand_range_start, $expand_range_end, $expand_as_floating ); + if ( $expanded->ComponentCount() == 0 ) continue; if ( $need_expansion ) $dav_object->caldav_data = $expanded->Render(); } @@ -356,6 +360,7 @@ if ( $qry->Exec("calquery",__LINE__,__FILE__) && $qry->rows() > 0 ) { } } } + $multistatus = new XMLElement( "multistatus", $responses, $reply->GetXmlNsArray() ); $request->XMLResponse( 207, $multistatus ); -- 2.11.4.GIT