dav/main.c

changeset 297
3cbe57eeaed1
parent 271
7b1ca53f3897
child 298
755b8198b071
--- a/dav/main.c	Tue Sep 05 13:07:29 2017 +0200
+++ b/dav/main.c	Tue Sep 05 16:03:48 2017 +0200
@@ -350,6 +350,9 @@
     return sn;
 }
 
+#define LIST_QUERY_ORDER_BY_NAME "select `idav:crypto-name`,`idav:crypto-key`,D:lockdiscovery,apache:executable from %s with depth = %d where lastmodified > %t order by iscollection desc, name"
+#define LIST_QUERY_ORDER_BY_DATE "select `idav:crypto-name`,`idav:crypto-key`,D:lockdiscovery,apache:executable from %s with depth = %d where lastmodified > %t order by iscollection desc, lastmodified desc"
+
 int cmd_list(CmdArgs *a) {
     if(a->argc != 1) {
         fprintf(stderr, "Too %s arguments\n", a->argc < 1 ? "few":"many");
@@ -366,6 +369,7 @@
     }
     
     char *update = cmd_getoption(a, "update");
+    char *date = cmd_getoption(a, "date");
     time_t t = -1;
     if(update) {
         t = util_parse_lastmodified(update);
@@ -377,7 +381,7 @@
     while(ret != 0) {
         ls = dav_query(
                 sn,
-                "select `idav:crypto-name`,`idav:crypto-key`,D:lockdiscovery,apache:executable from %s with depth = %d where lastmodified > %t order by iscollection desc, name",
+                date ? LIST_QUERY_ORDER_BY_DATE : LIST_QUERY_ORDER_BY_NAME,
                 path,
                 depth,
                 t);

mercurial