Fossil
Check-in [49e6670386]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:49e6670386005fa34186f357d0739f163cea88c6
Date: 2010-03-18 12:55:39
User: drh
Comment:Change the timeline comment when a wiki page is deleted. Remove some "#if 0" sections from the code.

Tags And Properties
Changes
[hide diffs]

Changes to src/manifest.c

@@ -1080,13 +1080,15 @@
   if( m.type==CFTYPE_WIKI ){
     char *zTag = mprintf("wiki-%s", m.zWikiTitle);
     int tagid = tag_findid(zTag, 1);
     int prior;
     char *zComment;
+    int nWiki;
     char zLength[40];
     while( isspace(m.zWiki[0]) ) m.zWiki++;
-    sqlite3_snprintf(sizeof(zLength), zLength, "%d", strlen(m.zWiki));
+    nWiki = strlen(m.zWiki);
+    sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
     tag_insert(zTag, 1, zLength, rid, m.rDate, rid);
     free(zTag);
     prior = db_int(0,
       "SELECT rid FROM tagxref"
       " WHERE tagid=%d AND mtime<%.17g"
@@ -1094,11 +1096,15 @@
       tagid, m.rDate
     );
     if( prior ){
       content_deltify(prior, rid, 0);
     }
-    zComment = mprintf("Changes to wiki page [%h]", m.zWikiTitle);
+    if( nWiki>0 ){
+      zComment = mprintf("Changes to wiki page [%h]", m.zWikiTitle);
+    }else{
+      zComment = mprintf("Deleted wiki page [%h]", m.zWikiTitle);
+    }
     db_multi_exec(
       "REPLACE INTO event(type,mtime,objid,user,comment,"
       "                  bgcolor,euser,ecomment)"
       "VALUES('w',%.17g,%d,%Q,%Q,"
       "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>1),"
@@ -1140,15 +1146,10 @@
     );
     if( strlen(m.zAttachTarget)!=UUID_SIZE
      || !validate16(m.zAttachTarget, UUID_SIZE)
     ){
       char *zComment;
-#if 0
-      char *zTag = mprintf("wiki-%s", m.zAttachTarget);
-      tag_findid(zTag, 1);
-      free(zTag);
-#endif
       if( m.zAttachSrc && m.zAttachSrc[0] ){
         zComment = mprintf("Add attachment \"%h\" to wiki page [%h]",
              m.zAttachName, m.zAttachTarget);
       }else{
         zComment = mprintf("Delete attachment \"%h\" from wiki page [%h]",

Changes to src/tkt.c

@@ -241,42 +241,10 @@
     manifest_ticket_event(rid, &manifest, createFlag, tagid);
     manifest_clear(&manifest);
     createFlag = 0;
   }
   db_finalize(&q);
-
-#if 0
-  db_prepare(&q,
-    "SELECT attachid, mtime, src IS NULL, filename, user"
-    "  FROM attachment"
-    " WHERE target=%Q",
-    zTktUuid
-  );
-  while( db_step(&q)==SQLITE_ROW ){
-    int attachid = db_column_int(&q, 0);
-    double mtime = db_column_double(&q, 1);
-    int isDelete = db_column_int(&q, 2);
-    const char *zFile = db_column_text(&q, 3);
-    const char *zUser = db_column_text(&q, 4);
-    char *zCom;
-
-    if( isDelete ){
-      zCom = mprintf("Delete attachment \"%h\" from ticket [%.10s] by user %h",
-                        zFile, zTktUuid, zUser);
-    }else{
-      zCom = mprintf("Add attachment \"%h\" to ticket [%.10s] by user %h",
-                        zFile, zTktUuid, zUser);
-    }
-    db_multi_exec(
-      "REPLACE INTO event(type,tagid,mtime,objid,user,comment,brief)"
-      "VALUES('t',%d,%.17g,%d,%Q,%Q,%Q)",
-      tagid, mtime, attachid, zUser, zCom, zCom
-    );
-    free(zCom);
-  }
-  db_finalize(&q);
-#endif
 }
 
 /*
 ** Create the subscript interpreter and load the "common" code.
 */