Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Enhance the artifact description logic to try to determine the source of phantom artifacts. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
7fd31f69571cae5ab1b497ac05676a34 |
| User & Date: | drh 2020-04-13 18:28:58.008 |
Context
|
2020-04-13
| ||
| 20:16 | Allow non-privileged users to see phantom artifacts in /bloblist. Private artifacts may still only be seen by high-privilege users. If an artifact is both private and a phantom, it is viewable because "private" in the context of a phantom is different from a real private artifact. check-in: b3a346e0e6 user: drh tags: trunk | |
| 18:28 | Enhance the artifact description logic to try to determine the source of phantom artifacts. check-in: 7fd31f6957 user: drh tags: trunk | |
| 17:09 | Faster implementation of the phantom artifact display on the /bloblist page. check-in: 28b92ca631 user: drh tags: trunk | |
Changes
Changes to src/name.c.
| ︙ | ︙ | |||
962 963 964 965 966 967 968 | @ rid INTEGER PRIMARY KEY, -- RID of the object @ uuid TEXT, -- hash of the object @ ctime DATETIME, -- Time of creation @ isPrivate BOOLEAN DEFAULT 0, -- True for unpublished artifacts @ type TEXT, -- file, checkin, wiki, ticket, etc. @ rcvid INT, -- When the artifact was received @ summary TEXT, -- Summary comment for the object | | > | 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | @ rid INTEGER PRIMARY KEY, -- RID of the object @ uuid TEXT, -- hash of the object @ ctime DATETIME, -- Time of creation @ isPrivate BOOLEAN DEFAULT 0, -- True for unpublished artifacts @ type TEXT, -- file, checkin, wiki, ticket, etc. @ rcvid INT, -- When the artifact was received @ summary TEXT, -- Summary comment for the object @ ref TEXT -- hash of an object to link against @ ); @ CREATE INDEX desctype ON description(summary) WHERE summary='unknown'; ; /* ** Create the description table if it does not already exists. ** Populate fields of this table with descriptions for all artifacts ** whose RID matches the SQL expression in zWhere. */ |
| ︙ | ︙ | |||
1099 1100 1101 1102 1103 1104 1105 |
" WHERE (forumpost.fpid %s)\n"
" AND postblob.rid=forumpost.fpid"
" AND rootblob.rid=forumpost.froot",
zWhere /*safe-for-%s*/
);
}
| | | > | | > > > > > > > > > > > > > > > > > > > > > > > > > | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 |
" WHERE (forumpost.fpid %s)\n"
" AND postblob.rid=forumpost.fpid"
" AND rootblob.rid=forumpost.froot",
zWhere /*safe-for-%s*/
);
}
/* Mark all other artifacts as "unknown" for now */
db_multi_exec(
"INSERT OR IGNORE INTO description(rid,uuid,rcvid,type,summary)\n"
"SELECT blob.rid, blob.uuid,blob.rcvid,\n"
" CASE WHEN EXISTS(SELECT 1 FROM phantom WHERE rid=blob.rid)\n"
" THEN 'phantom' ELSE '' END,\n"
" 'unknown'\n"
" FROM blob\n"
" WHERE (blob.rid %s)\n"
" AND (blob.rid NOT IN (SELECT rid FROM description));",
zWhere /*safe-for-%s*/
);
/* Mark private elements */
db_multi_exec(
"UPDATE description SET isPrivate=1 WHERE rid IN private"
);
/* Try to figure out the origin of unknown artifacts */
db_multi_exec(
"REPLACE INTO description(rid,uuid,isPrivate,type,summary,ref)\n"
" SELECT description.rid, description.uuid, isPrivate, type,\n"
" CASE WHEN plink.isprim THEN '' ELSE 'merge ' END ||\n"
" 'parent of check-in', blob.uuid\n"
" FROM description, plink, blob\n"
" WHERE description.summary='unknown'\n"
" AND plink.pid=description.rid\n"
" AND blob.rid=plink.cid;"
);
db_multi_exec(
"REPLACE INTO description(rid,uuid,isPrivate,type,summary,ref)\n"
" SELECT description.rid, description.uuid, isPrivate, type,\n"
" 'check-in referenced by \"'||tag.tagname ||'\" tag',\n"
" blob.uuid\n"
" FROM description, tagxref, tag, blob\n"
" WHERE description.summary='unknown'\n"
" AND tagxref.origid=description.rid\n"
" AND tag.tagid=tagxref.tagid\n"
" AND blob.rid=tagxref.srcid;"
);
}
/*
** Print the content of the description table on stdout.
**
** The description table is computed using the WHERE clause zWhere if
** the zWhere parameter is not NULL. If zWhere is NULL, then this
|
| ︙ | ︙ | |||
1239 1240 1241 1242 1243 1244 1245 |
zRange = mprintf("IN phantom");
}else{
zRange = mprintf("BETWEEN %d AND %d", s, s+n-1);
}
describe_artifacts(zRange);
fossil_free(zRange);
db_prepare(&q,
| | | | > | 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 |
zRange = mprintf("IN phantom");
}else{
zRange = mprintf("BETWEEN %d AND %d", s, s+n-1);
}
describe_artifacts(zRange);
fossil_free(zRange);
db_prepare(&q,
"SELECT rid, uuid, summary, isPrivate, type='phantom', rcvid, ref"
" FROM description ORDER BY rid"
);
if( skin_detail_boolean("white-foreground") ){
zSha1Bg = "#714417";
zSha3Bg = "#177117";
}else{
zSha1Bg = "#ebffb0";
zSha3Bg = "#b0ffb0";
}
@ <table cellpadding="2" cellspacing="0" border="1">
if( g.perm.Admin ){
@ <tr><th>RID<th>Hash<th>Rcvid<th>Description<th>Ref<th>Remarks
}else{
@ <tr><th>RID<th>Hash<th>Description<th>Ref<th>Remarks
}
while( db_step(&q)==SQLITE_ROW ){
int rid = db_column_int(&q,0);
const char *zUuid = db_column_text(&q, 1);
const char *zDesc = db_column_text(&q, 2);
int isPriv = db_column_int(&q,3);
int isPhantom = db_column_int(&q,4);
const char *zRef = db_column_text(&q,6);
if( isPhantom && !g.perm.Admin ){
/* Do not show phantom artifacts to non-admin users */
continue;
}
if( isPriv && !g.perm.Private && !g.perm.Admin ){
/* Don't show private artifacts to users without Private (x) permission */
continue;
|
| ︙ | ︙ | |||
1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 |
if( rcvid<=0 ){
@ <td>
}else{
@ <td><a href='%R/rcvfrom?rcvid=%d(rcvid)'>%d(rcvid)</a>
}
}
@ <td align="left">%h(zDesc)</td>
if( isPriv || isPhantom ){
if( isPriv==0 ){
@ <td>phantom</td>
}else if( isPhantom==0 ){
@ <td>private</td>
}else{
@ <td>private,phantom</td>
| > > > > > | 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 |
if( rcvid<=0 ){
@ <td>
}else{
@ <td><a href='%R/rcvfrom?rcvid=%d(rcvid)'>%d(rcvid)</a>
}
}
@ <td align="left">%h(zDesc)</td>
if( zRef && zRef[0] ){
@ <td>%z(href("%R/info/%!S",zRef))%S(zRef)</a>
}else{
@ <td>
}
if( isPriv || isPhantom ){
if( isPriv==0 ){
@ <td>phantom</td>
}else if( isPhantom==0 ){
@ <td>private</td>
}else{
@ <td>private,phantom</td>
|
| ︙ | ︙ |