Only return an ordered set if so configured.

This commit is contained in:
Andrew McMillan 2009-10-06 14:37:58 +13:00
parent 95217eebf9
commit 9e1b4170a7

View File

@ -588,7 +588,7 @@ function item_to_xml( $item ) {
* a list of calendars for the user which are parented by this path. * a list of calendars for the user which are parented by this path.
*/ */
function get_collection_contents( $depth, $user_no, $collection ) { function get_collection_contents( $depth, $user_no, $collection ) {
global $session, $request, $reply, $prop_list, $arbitrary; global $c, $session, $request, $reply, $prop_list, $arbitrary;
dbg_error_log('PROPFIND','Getting collection contents: Depth %d, User: %d, Path: %s', $depth, $user_no, $collection->dav_name ); dbg_error_log('PROPFIND','Getting collection contents: Depth %d, User: %d, Path: %s', $depth, $user_no, $collection->dav_name );
@ -658,7 +658,7 @@ function get_collection_contents( $depth, $user_no, $collection ) {
$sql .= 'summary AS dav_displayname '; $sql .= 'summary AS dav_displayname ';
$sql .= 'FROM caldav_data JOIN calendar_item USING( dav_id, user_no, dav_name) '; $sql .= 'FROM caldav_data JOIN calendar_item USING( dav_id, user_no, dav_name) ';
$sql .= 'WHERE dav_name ~ '.qpg('^'.$collection->dav_name.'[^/]+$'). $privacy_clause; $sql .= 'WHERE dav_name ~ '.qpg('^'.$collection->dav_name.'[^/]+$'). $privacy_clause;
$sql .= 'ORDER BY dav_name'; if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY dav_id";
$qry = new PgQuery($sql, PgQuery::Plain(iCalendar::HttpDateFormat()), PgQuery::Plain(iCalendar::HttpDateFormat())); $qry = new PgQuery($sql, PgQuery::Plain(iCalendar::HttpDateFormat()), PgQuery::Plain(iCalendar::HttpDateFormat()));
if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows > 0 ) { if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows > 0 ) {
while( $item = $qry->Fetch() ) { while( $item = $qry->Fetch() ) {