Fossil SCM

Add the /bigbloblist information page.

drh 2015-12-05 19:21 UTC trunk
Commit 483317fb0e99bf2d001db9fab798b5de62b63aac
1 file changed +53 -1
+53 -1
--- src/name.c
+++ src/name.c
@@ -989,10 +989,11 @@
989989
char *zRange;
990990
991991
login_check_credentials();
992992
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
993993
style_header("List Of Artifacts");
994
+ style_submenu_element("250 Largest", 0, "bigbloblist");
994995
if( mx>n && P("s")==0 ){
995996
int i;
996997
@ <p>Select a range of artifacts to view:</p>
997998
@ <ul>
998999
for(i=1; i<=mx; i+=n){
@@ -1014,18 +1015,69 @@
10141015
@ <table cellpadding="0" cellspacing="0">
10151016
while( db_step(&q)==SQLITE_ROW ){
10161017
int rid = db_column_int(&q,0);
10171018
const char *zUuid = db_column_text(&q, 1);
10181019
const char *zDesc = db_column_text(&q, 2);
1019
- int isPriv = db_column_int(&q,2);
1020
+ int isPriv = db_column_int(&q,3);
10201021
@ <tr><td align="right">%d(rid)</td>
10211022
@ <td>&nbsp;%z(href("%R/info/%!S",zUuid))%s(zUuid)</a>&nbsp;</td>
10221023
@ <td align="left">%h(zDesc)</td>
10231024
if( isPriv ){
10241025
@ <td>(unpublished)</td>
10251026
}
10261027
@ </tr>
1028
+ }
1029
+ @ </table>
1030
+ db_finalize(&q);
1031
+ style_footer();
1032
+}
1033
+
1034
+/*
1035
+** WEBPAGE: bigbloblist
1036
+**
1037
+** Return a page showing the largest artifacts in the repository in order
1038
+** of decreasing size.
1039
+**
1040
+** n=N Show the top N artifacts
1041
+*/
1042
+void bigbloblist_page(void){
1043
+ Stmt q;
1044
+ int n = atoi(PD("n","250"));
1045
+
1046
+ login_check_credentials();
1047
+ if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1048
+ style_header("%d Largest Artifacts", n);
1049
+ db_multi_exec(
1050
+ "CREATE TEMP TABLE toshow(rid INTEGER PRIMARY KEY);"
1051
+ "INSERT INTO toshow(rid)"
1052
+ " SELECT rid FROM blob"
1053
+ " ORDER BY length(content) DESC"
1054
+ " LIMIT %d;", n
1055
+ );
1056
+ describe_artifacts("IN toshow");
1057
+ db_prepare(&q,
1058
+ "SELECT description.rid, description.uuid, description.summary,"
1059
+ " length(blob.content), coalesce(delta.srcid,'')"
1060
+ " FROM description, blob LEFT JOIN delta ON delta.rid=blob.rid"
1061
+ " WHERE description.rid=blob.rid"
1062
+ " ORDER BY length(content) DESC"
1063
+ );
1064
+ @ <table cellpadding="0" cellspacing="0" border="1">
1065
+ @ <tr><th align="right">Size<th align="right">RID
1066
+ @ <th align="right">Delta From<th>SHA1<th>Description
1067
+ while( db_step(&q)==SQLITE_ROW ){
1068
+ int rid = db_column_int(&q,0);
1069
+ const char *zUuid = db_column_text(&q, 1);
1070
+ const char *zDesc = db_column_text(&q, 2);
1071
+ int sz = db_column_int(&q,3);
1072
+ const char *zSrcId = db_column_text(&q,4);
1073
+ @ <tr><td align="right">%d(sz)</td>
1074
+ @ <td align="right">%d(rid)</td>
1075
+ @ <td align="right">%s(zSrcId)</td>
1076
+ @ <td>&nbsp;%z(href("%R/info/%!S",zUuid))%s(zUuid)</a>&nbsp;</td>
1077
+ @ <td align="left">%h(zDesc)</td>
1078
+ @ </tr>
10271079
}
10281080
@ </table>
10291081
db_finalize(&q);
10301082
style_footer();
10311083
}
10321084
--- src/name.c
+++ src/name.c
@@ -989,10 +989,11 @@
989 char *zRange;
990
991 login_check_credentials();
992 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
993 style_header("List Of Artifacts");
 
994 if( mx>n && P("s")==0 ){
995 int i;
996 @ <p>Select a range of artifacts to view:</p>
997 @ <ul>
998 for(i=1; i<=mx; i+=n){
@@ -1014,18 +1015,69 @@
1014 @ <table cellpadding="0" cellspacing="0">
1015 while( db_step(&q)==SQLITE_ROW ){
1016 int rid = db_column_int(&q,0);
1017 const char *zUuid = db_column_text(&q, 1);
1018 const char *zDesc = db_column_text(&q, 2);
1019 int isPriv = db_column_int(&q,2);
1020 @ <tr><td align="right">%d(rid)</td>
1021 @ <td>&nbsp;%z(href("%R/info/%!S",zUuid))%s(zUuid)</a>&nbsp;</td>
1022 @ <td align="left">%h(zDesc)</td>
1023 if( isPriv ){
1024 @ <td>(unpublished)</td>
1025 }
1026 @ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1027 }
1028 @ </table>
1029 db_finalize(&q);
1030 style_footer();
1031 }
1032
--- src/name.c
+++ src/name.c
@@ -989,10 +989,11 @@
989 char *zRange;
990
991 login_check_credentials();
992 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
993 style_header("List Of Artifacts");
994 style_submenu_element("250 Largest", 0, "bigbloblist");
995 if( mx>n && P("s")==0 ){
996 int i;
997 @ <p>Select a range of artifacts to view:</p>
998 @ <ul>
999 for(i=1; i<=mx; i+=n){
@@ -1014,18 +1015,69 @@
1015 @ <table cellpadding="0" cellspacing="0">
1016 while( db_step(&q)==SQLITE_ROW ){
1017 int rid = db_column_int(&q,0);
1018 const char *zUuid = db_column_text(&q, 1);
1019 const char *zDesc = db_column_text(&q, 2);
1020 int isPriv = db_column_int(&q,3);
1021 @ <tr><td align="right">%d(rid)</td>
1022 @ <td>&nbsp;%z(href("%R/info/%!S",zUuid))%s(zUuid)</a>&nbsp;</td>
1023 @ <td align="left">%h(zDesc)</td>
1024 if( isPriv ){
1025 @ <td>(unpublished)</td>
1026 }
1027 @ </tr>
1028 }
1029 @ </table>
1030 db_finalize(&q);
1031 style_footer();
1032 }
1033
1034 /*
1035 ** WEBPAGE: bigbloblist
1036 **
1037 ** Return a page showing the largest artifacts in the repository in order
1038 ** of decreasing size.
1039 **
1040 ** n=N Show the top N artifacts
1041 */
1042 void bigbloblist_page(void){
1043 Stmt q;
1044 int n = atoi(PD("n","250"));
1045
1046 login_check_credentials();
1047 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1048 style_header("%d Largest Artifacts", n);
1049 db_multi_exec(
1050 "CREATE TEMP TABLE toshow(rid INTEGER PRIMARY KEY);"
1051 "INSERT INTO toshow(rid)"
1052 " SELECT rid FROM blob"
1053 " ORDER BY length(content) DESC"
1054 " LIMIT %d;", n
1055 );
1056 describe_artifacts("IN toshow");
1057 db_prepare(&q,
1058 "SELECT description.rid, description.uuid, description.summary,"
1059 " length(blob.content), coalesce(delta.srcid,'')"
1060 " FROM description, blob LEFT JOIN delta ON delta.rid=blob.rid"
1061 " WHERE description.rid=blob.rid"
1062 " ORDER BY length(content) DESC"
1063 );
1064 @ <table cellpadding="0" cellspacing="0" border="1">
1065 @ <tr><th align="right">Size<th align="right">RID
1066 @ <th align="right">Delta From<th>SHA1<th>Description
1067 while( db_step(&q)==SQLITE_ROW ){
1068 int rid = db_column_int(&q,0);
1069 const char *zUuid = db_column_text(&q, 1);
1070 const char *zDesc = db_column_text(&q, 2);
1071 int sz = db_column_int(&q,3);
1072 const char *zSrcId = db_column_text(&q,4);
1073 @ <tr><td align="right">%d(sz)</td>
1074 @ <td align="right">%d(rid)</td>
1075 @ <td align="right">%s(zSrcId)</td>
1076 @ <td>&nbsp;%z(href("%R/info/%!S",zUuid))%s(zUuid)</a>&nbsp;</td>
1077 @ <td align="left">%h(zDesc)</td>
1078 @ </tr>
1079 }
1080 @ </table>
1081 db_finalize(&q);
1082 style_footer();
1083 }
1084

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button