205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
Stmt ins;
int i;
zAs = find_option("as",0,1);
if( zAs && g.argc!=4 ) usage("add DISKFILE --as UVFILE");
verify_all_options();
db_begin_transaction();
content_rcvid_init();
db_prepare(&ins,
"REPLACE INTO unversioned(name,rcvid,mtime,hash,sz,encoding,content)"
" VALUES(:name,:rcvid,:mtime,:hash,:sz,:encoding,:content)"
);
for(i=3; i<g.argc; i++){
zIn = zAs ? zAs : g.argv[i];
|
>
>
|
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
Stmt ins;
int i;
zAs = find_option("as",0,1);
if( zAs && g.argc!=4 ) usage("add DISKFILE --as UVFILE");
verify_all_options();
db_begin_transaction();
user_select();
g.zIpAddr = "command-line";
content_rcvid_init();
db_prepare(&ins,
"REPLACE INTO unversioned(name,rcvid,mtime,hash,sz,encoding,content)"
" VALUES(:name,:rcvid,:mtime,:hash,:sz,:encoding,:content)"
);
for(i=3; i<g.argc; i++){
zIn = zAs ? zAs : g.argv[i];
|
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
|
style_footer();
return;
}
db_prepare(&q,
"SELECT"
" name,"
" mtime,"
" hash IS NULL,"
" sz"
" FROM unversioned"
);
iNow = db_int64(0, "SELECT strftime('%%s','now');");
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
sqlite3_int64 mtime = db_column_int(&q, 1);
int isDeleted = db_column_int(&q, 2);
int fullSize = db_column_int(&q, 3);
char *zAge = human_readable_age((iNow - mtime)/86400.0);
if( (n++)==0 ){
@ <div class="uvlist">
@ <table cellpadding="2" cellspacing="0" border="1" id="uvtab">
@ <thead><tr>
@ <th> Name
@ <th> Age
@ <th> Size
@ </tr></thead>
@ <tbody>
}
if( isDeleted ){
sqlite3_snprintf(sizeof(zSzName), zSzName, "<i>Deleted</i>");
fullSize = 0;
}else{
approxSizeName(sizeof(zSzName), zSzName, fullSize);
iTotalSz += fullSize;
cnt++;
}
@ <tr>
@ <td> <a href='%R/uv/%T(zName)'>%h(zName)</a> </td>
@ <td data-sortkey='%016llx(-mtime)'> %s(zAge) </td>
@ <td data-sortkey='%08x(fullSize)'> %s(zSzName) </td>
@ </tr>
fossil_free(zAge);
}
db_finalize(&q);
if( n ){
approxSizeName(sizeof(zSzName), zSzName, iTotalSz);
@ </tbody>
@ <tfoot><tr><td><b>Total over %d(cnt) files</b><td><td>%s(zSzName)</tfoot>
@ </table></div>
output_table_sorting_javascript("uvtab","tKk",1);
}else{
@ No unversioned files on this server.
}
style_footer();
}
|
|
|
>
>
>
|
>
>
>
>
>
>
>
|
>
|
|
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
|
style_footer();
return;
}
db_prepare(&q,
"SELECT"
" name,"
" mtime,"
" hash,"
" sz,"
" (SELECT login FROM rcvfrom, user"
" WHERE user.uid=rcvfrom.uid AND rcvfrom.rcvid=unversioned.rcvid)"
" FROM unversioned"
);
iNow = db_int64(0, "SELECT strftime('%%s','now');");
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
sqlite3_int64 mtime = db_column_int(&q, 1);
const char *zHash = db_column_text(&q, 2);
int isDeleted = zHash==0;
int fullSize = db_column_int(&q, 3);
char *zAge = human_readable_age((iNow - mtime)/86400.0);
const char *zLogin = db_column_text(&q, 4);
if( zLogin==0 ) zLogin = "";
if( (n++)==0 ){
@ <div class="uvlist">
@ <table cellpadding="2" cellspacing="0" border="1" id="uvtab">
@ <thead><tr>
@ <th> Name
@ <th> Age
@ <th> Size
@ <th> User
@ <th> SHA1
@ </tr></thead>
@ <tbody>
}
if( isDeleted ){
sqlite3_snprintf(sizeof(zSzName), zSzName, "<i>Deleted</i>");
zHash = "";
fullSize = 0;
}else{
approxSizeName(sizeof(zSzName), zSzName, fullSize);
iTotalSz += fullSize;
cnt++;
}
@ <tr>
@ <td> <a href='%R/uv/%T(zName)'>%h(zName)</a> </td>
@ <td data-sortkey='%016llx(-mtime)'> %s(zAge) </td>
@ <td data-sortkey='%08x(fullSize)'> %s(zSzName) </td>
@ <td> %h(zLogin) </td>
@ <td> %h(zHash) </td>
@ </tr>
fossil_free(zAge);
}
db_finalize(&q);
if( n ){
approxSizeName(sizeof(zSzName), zSzName, iTotalSz);
@ </tbody>
@ <tfoot><tr><td><b>Total over %d(cnt) files</b><td><td>%s(zSzName)
@ <td><td></tfoot>
@ </table></div>
output_table_sorting_javascript("uvtab","tKktt",1);
}else{
@ No unversioned files on this server.
}
style_footer();
}
|