Fossil SCM

The "Code" on an inter-wiki link must be ascii alphanumeric. Sync the inter-wiki config table entries on clone.

drh 2020-08-22 23:21 interwiki
Commit 550536789fbefa43f825908300577f568b34bd48cefdc29f9b52cc581531eed7
2 files changed +35 -12 +4 -2
+35 -12
--- src/configure.c
+++ src/configure.c
@@ -37,11 +37,12 @@
3737
#define CONFIGSET_USER 0x000020 /* The USER table */
3838
#define CONFIGSET_ADDR 0x000040 /* The CONCEALED table */
3939
#define CONFIGSET_XFER 0x000080 /* Transfer configuration */
4040
#define CONFIGSET_ALIAS 0x000100 /* URL Aliases */
4141
#define CONFIGSET_SCRIBER 0x000200 /* Email subscribers */
42
-#define CONFIGSET_ALL 0x0003ff /* Everything */
42
+#define CONFIGSET_IWIKI 0x000400 /* Interwiki codes */
43
+#define CONFIGSET_ALL 0x0007ff /* Everything */
4344
4445
#define CONFIGSET_OVERWRITE 0x100000 /* Causes overwrite instead of merge */
4546
4647
/*
4748
** This mask is used for the common TH1 configuration settings (i.e. those
@@ -58,22 +59,23 @@
5859
static struct {
5960
const char *zName; /* Name of the configuration set */
6061
int groupMask; /* Mask for that configuration set */
6162
const char *zHelp; /* What it does */
6263
} aGroupName[] = {
63
- { "/email", CONFIGSET_ADDR, "Concealed email addresses in tickets" },
64
- { "/project", CONFIGSET_PROJ, "Project name and description" },
64
+ { "/email", CONFIGSET_ADDR, "Concealed email addresses in tickets" },
65
+ { "/project", CONFIGSET_PROJ, "Project name and description" },
6566
{ "/skin", CONFIGSET_SKIN | CONFIGSET_CSS,
66
- "Web interface appearance settings" },
67
- { "/css", CONFIGSET_CSS, "Style sheet" },
68
- { "/shun", CONFIGSET_SHUN, "List of shunned artifacts" },
69
- { "/ticket", CONFIGSET_TKT, "Ticket setup", },
70
- { "/user", CONFIGSET_USER, "Users and privilege settings" },
71
- { "/xfer", CONFIGSET_XFER, "Transfer setup", },
72
- { "/alias", CONFIGSET_ALIAS, "URL Aliases", },
73
- { "/subscriber", CONFIGSET_SCRIBER,"Email notification subscriber list" },
74
- { "/all", CONFIGSET_ALL, "All of the above" },
67
+ "Web interface appearance settings" },
68
+ { "/css", CONFIGSET_CSS, "Style sheet" },
69
+ { "/shun", CONFIGSET_SHUN, "List of shunned artifacts" },
70
+ { "/ticket", CONFIGSET_TKT, "Ticket setup", },
71
+ { "/user", CONFIGSET_USER, "Users and privilege settings" },
72
+ { "/xfer", CONFIGSET_XFER, "Transfer setup", },
73
+ { "/alias", CONFIGSET_ALIAS, "URL Aliases", },
74
+ { "/subscriber", CONFIGSET_SCRIBER, "Email notification subscriber list" },
75
+ { "/interwiki", CONFIGSET_IWIKI, "Inter-wiki link prefixes" },
76
+ { "/all", CONFIGSET_ALL, "All of the above" },
7577
};
7678
7779
7880
/*
7981
** The following is a list of settings that we are willing to
@@ -175,10 +177,12 @@
175177
176178
{ "@alias", CONFIGSET_ALIAS },
177179
178180
{ "@subscriber", CONFIGSET_SCRIBER },
179181
182
+ { "@interwiki", CONFIGSET_IWIKI },
183
+
180184
{ "xfer-common-script", CONFIGSET_XFER },
181185
{ "xfer-push-script", CONFIGSET_XFER },
182186
{ "xfer-commit-script", CONFIGSET_XFER },
183187
{ "xfer-ticket-script", CONFIGSET_XFER },
184188
@@ -257,10 +261,13 @@
257261
return m;
258262
}
259263
}
260264
if( strncmp(zName, "walias:/", 8)==0 ){
261265
return CONFIGSET_ALIAS;
266
+ }
267
+ if( strncmp(zName, "intermap:/", 10)==0 ){
268
+ return CONFIGSET_PROJ;
262269
}
263270
return 0;
264271
}
265272
266273
/*
@@ -587,10 +594,26 @@
587594
while( db_step(&q)==SQLITE_ROW ){
588595
blob_appendf(&rec,"%s %s value %s",
589596
db_column_text(&q, 0),
590597
db_column_text(&q, 1),
591598
db_column_text(&q, 2)
599
+ );
600
+ blob_appendf(pOut, "config /config %d\n%s\n",
601
+ blob_size(&rec), blob_str(&rec));
602
+ nCard++;
603
+ blob_reset(&rec);
604
+ }
605
+ db_finalize(&q);
606
+ }
607
+ if( groupMask & CONFIGSET_IWIKI ){
608
+ db_prepare(&q, "SELECT mtime, quote(name), quote(value) FROM config"
609
+ " WHERE name GLOB 'intermap:/*' AND mtime>=%lld", iStart);
610
+ while( db_step(&q)==SQLITE_ROW ){
611
+ blob_appendf(&rec,"%s %s value %s",
612
+ db_column_text(&q, 0),
613
+ db_column_text(&q, 1),
614
+ db_column_text(&q, 2)
592615
);
593616
blob_appendf(pOut, "config /config %d\n%s\n",
594617
blob_size(&rec), blob_str(&rec));
595618
nCard++;
596619
blob_reset(&rec);
597620
--- src/configure.c
+++ src/configure.c
@@ -37,11 +37,12 @@
37 #define CONFIGSET_USER 0x000020 /* The USER table */
38 #define CONFIGSET_ADDR 0x000040 /* The CONCEALED table */
39 #define CONFIGSET_XFER 0x000080 /* Transfer configuration */
40 #define CONFIGSET_ALIAS 0x000100 /* URL Aliases */
41 #define CONFIGSET_SCRIBER 0x000200 /* Email subscribers */
42 #define CONFIGSET_ALL 0x0003ff /* Everything */
 
43
44 #define CONFIGSET_OVERWRITE 0x100000 /* Causes overwrite instead of merge */
45
46 /*
47 ** This mask is used for the common TH1 configuration settings (i.e. those
@@ -58,22 +59,23 @@
58 static struct {
59 const char *zName; /* Name of the configuration set */
60 int groupMask; /* Mask for that configuration set */
61 const char *zHelp; /* What it does */
62 } aGroupName[] = {
63 { "/email", CONFIGSET_ADDR, "Concealed email addresses in tickets" },
64 { "/project", CONFIGSET_PROJ, "Project name and description" },
65 { "/skin", CONFIGSET_SKIN | CONFIGSET_CSS,
66 "Web interface appearance settings" },
67 { "/css", CONFIGSET_CSS, "Style sheet" },
68 { "/shun", CONFIGSET_SHUN, "List of shunned artifacts" },
69 { "/ticket", CONFIGSET_TKT, "Ticket setup", },
70 { "/user", CONFIGSET_USER, "Users and privilege settings" },
71 { "/xfer", CONFIGSET_XFER, "Transfer setup", },
72 { "/alias", CONFIGSET_ALIAS, "URL Aliases", },
73 { "/subscriber", CONFIGSET_SCRIBER,"Email notification subscriber list" },
74 { "/all", CONFIGSET_ALL, "All of the above" },
 
75 };
76
77
78 /*
79 ** The following is a list of settings that we are willing to
@@ -175,10 +177,12 @@
175
176 { "@alias", CONFIGSET_ALIAS },
177
178 { "@subscriber", CONFIGSET_SCRIBER },
179
 
 
180 { "xfer-common-script", CONFIGSET_XFER },
181 { "xfer-push-script", CONFIGSET_XFER },
182 { "xfer-commit-script", CONFIGSET_XFER },
183 { "xfer-ticket-script", CONFIGSET_XFER },
184
@@ -257,10 +261,13 @@
257 return m;
258 }
259 }
260 if( strncmp(zName, "walias:/", 8)==0 ){
261 return CONFIGSET_ALIAS;
 
 
 
262 }
263 return 0;
264 }
265
266 /*
@@ -587,10 +594,26 @@
587 while( db_step(&q)==SQLITE_ROW ){
588 blob_appendf(&rec,"%s %s value %s",
589 db_column_text(&q, 0),
590 db_column_text(&q, 1),
591 db_column_text(&q, 2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592 );
593 blob_appendf(pOut, "config /config %d\n%s\n",
594 blob_size(&rec), blob_str(&rec));
595 nCard++;
596 blob_reset(&rec);
597
--- src/configure.c
+++ src/configure.c
@@ -37,11 +37,12 @@
37 #define CONFIGSET_USER 0x000020 /* The USER table */
38 #define CONFIGSET_ADDR 0x000040 /* The CONCEALED table */
39 #define CONFIGSET_XFER 0x000080 /* Transfer configuration */
40 #define CONFIGSET_ALIAS 0x000100 /* URL Aliases */
41 #define CONFIGSET_SCRIBER 0x000200 /* Email subscribers */
42 #define CONFIGSET_IWIKI 0x000400 /* Interwiki codes */
43 #define CONFIGSET_ALL 0x0007ff /* Everything */
44
45 #define CONFIGSET_OVERWRITE 0x100000 /* Causes overwrite instead of merge */
46
47 /*
48 ** This mask is used for the common TH1 configuration settings (i.e. those
@@ -58,22 +59,23 @@
59 static struct {
60 const char *zName; /* Name of the configuration set */
61 int groupMask; /* Mask for that configuration set */
62 const char *zHelp; /* What it does */
63 } aGroupName[] = {
64 { "/email", CONFIGSET_ADDR, "Concealed email addresses in tickets" },
65 { "/project", CONFIGSET_PROJ, "Project name and description" },
66 { "/skin", CONFIGSET_SKIN | CONFIGSET_CSS,
67 "Web interface appearance settings" },
68 { "/css", CONFIGSET_CSS, "Style sheet" },
69 { "/shun", CONFIGSET_SHUN, "List of shunned artifacts" },
70 { "/ticket", CONFIGSET_TKT, "Ticket setup", },
71 { "/user", CONFIGSET_USER, "Users and privilege settings" },
72 { "/xfer", CONFIGSET_XFER, "Transfer setup", },
73 { "/alias", CONFIGSET_ALIAS, "URL Aliases", },
74 { "/subscriber", CONFIGSET_SCRIBER, "Email notification subscriber list" },
75 { "/interwiki", CONFIGSET_IWIKI, "Inter-wiki link prefixes" },
76 { "/all", CONFIGSET_ALL, "All of the above" },
77 };
78
79
80 /*
81 ** The following is a list of settings that we are willing to
@@ -175,10 +177,12 @@
177
178 { "@alias", CONFIGSET_ALIAS },
179
180 { "@subscriber", CONFIGSET_SCRIBER },
181
182 { "@interwiki", CONFIGSET_IWIKI },
183
184 { "xfer-common-script", CONFIGSET_XFER },
185 { "xfer-push-script", CONFIGSET_XFER },
186 { "xfer-commit-script", CONFIGSET_XFER },
187 { "xfer-ticket-script", CONFIGSET_XFER },
188
@@ -257,10 +261,13 @@
261 return m;
262 }
263 }
264 if( strncmp(zName, "walias:/", 8)==0 ){
265 return CONFIGSET_ALIAS;
266 }
267 if( strncmp(zName, "intermap:/", 10)==0 ){
268 return CONFIGSET_PROJ;
269 }
270 return 0;
271 }
272
273 /*
@@ -587,10 +594,26 @@
594 while( db_step(&q)==SQLITE_ROW ){
595 blob_appendf(&rec,"%s %s value %s",
596 db_column_text(&q, 0),
597 db_column_text(&q, 1),
598 db_column_text(&q, 2)
599 );
600 blob_appendf(pOut, "config /config %d\n%s\n",
601 blob_size(&rec), blob_str(&rec));
602 nCard++;
603 blob_reset(&rec);
604 }
605 db_finalize(&q);
606 }
607 if( groupMask & CONFIGSET_IWIKI ){
608 db_prepare(&q, "SELECT mtime, quote(name), quote(value) FROM config"
609 " WHERE name GLOB 'intermap:/*' AND mtime>=%lld", iStart);
610 while( db_step(&q)==SQLITE_ROW ){
611 blob_appendf(&rec,"%s %s value %s",
612 db_column_text(&q, 0),
613 db_column_text(&q, 1),
614 db_column_text(&q, 2)
615 );
616 blob_appendf(pOut, "config /config %d\n%s\n",
617 blob_size(&rec), blob_str(&rec));
618 nCard++;
619 blob_reset(&rec);
620
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1208,10 +1208,12 @@
12081208
** An interwiki link target is of the form:
12091209
**
12101210
** Code:PageName
12111211
**
12121212
** "Code" is a brief code that describes the intended target wiki.
1213
+** The code must be ASCII alpha-numeric. No symbols or non-ascii
1214
+** characters are allows. Case is ignored for the code.
12131215
** Codes are assigned by "intermap:*" entries in the CONFIG table.
12141216
** The link is only valid if there exists an try in the CONFIG table
12151217
** that matches "intermap:Code".
12161218
**
12171219
** Each value of each intermap:Code entry in the CONFIG table is a JSON
@@ -1251,12 +1253,12 @@
12511253
int i;
12521254
const char *zPage;
12531255
int nPage;
12541256
char *zUrl = 0;
12551257
Stmt q;
1256
- for(i=0; zTarget[i] && zTarget[i]!=':'; i++){}
1257
- if( zTarget[i]==0 ) return 0;
1258
+ for(i=0; fossil_isalnum(zTarget[i]); i++){}
1259
+ if( zTarget[i]!=':' ) return 0;
12581260
nCode = i;
12591261
if( nCode==4 && strncmp(zTarget,"wiki",4)==0 ) return 0;
12601262
zPage = zTarget + nCode + 1;
12611263
nPage = (int)strlen(zPage);
12621264
db_prepare(&q,
12631265
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1208,10 +1208,12 @@
1208 ** An interwiki link target is of the form:
1209 **
1210 ** Code:PageName
1211 **
1212 ** "Code" is a brief code that describes the intended target wiki.
 
 
1213 ** Codes are assigned by "intermap:*" entries in the CONFIG table.
1214 ** The link is only valid if there exists an try in the CONFIG table
1215 ** that matches "intermap:Code".
1216 **
1217 ** Each value of each intermap:Code entry in the CONFIG table is a JSON
@@ -1251,12 +1253,12 @@
1251 int i;
1252 const char *zPage;
1253 int nPage;
1254 char *zUrl = 0;
1255 Stmt q;
1256 for(i=0; zTarget[i] && zTarget[i]!=':'; i++){}
1257 if( zTarget[i]==0 ) return 0;
1258 nCode = i;
1259 if( nCode==4 && strncmp(zTarget,"wiki",4)==0 ) return 0;
1260 zPage = zTarget + nCode + 1;
1261 nPage = (int)strlen(zPage);
1262 db_prepare(&q,
1263
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1208,10 +1208,12 @@
1208 ** An interwiki link target is of the form:
1209 **
1210 ** Code:PageName
1211 **
1212 ** "Code" is a brief code that describes the intended target wiki.
1213 ** The code must be ASCII alpha-numeric. No symbols or non-ascii
1214 ** characters are allows. Case is ignored for the code.
1215 ** Codes are assigned by "intermap:*" entries in the CONFIG table.
1216 ** The link is only valid if there exists an try in the CONFIG table
1217 ** that matches "intermap:Code".
1218 **
1219 ** Each value of each intermap:Code entry in the CONFIG table is a JSON
@@ -1251,12 +1253,12 @@
1253 int i;
1254 const char *zPage;
1255 int nPage;
1256 char *zUrl = 0;
1257 Stmt q;
1258 for(i=0; fossil_isalnum(zTarget[i]); i++){}
1259 if( zTarget[i]!=':' ) return 0;
1260 nCode = i;
1261 if( nCode==4 && strncmp(zTarget,"wiki",4)==0 ) return 0;
1262 zPage = zTarget + nCode + 1;
1263 nPage = (int)strlen(zPage);
1264 db_prepare(&q,
1265

Keyboard Shortcuts

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