Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Change all calls to json_extract() into uses of the new ->> operator. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
50d433e5b0b483a7b910f1c76fc252ae |
| User & Date: | drh 2022-01-13 12:50:02.588 |
Context
|
2022-01-13
| ||
| 19:45 | Promote the test-detach to be just "detach". Provide better help. Require user confirmation. For "fossil pull --from-parent-project" remember the URL of the last parent project pull. Remove parent-project settings on a "fossil scrub". ... (check-in: b3f3a898c8 user: drh tags: trunk) | |
| 12:50 | Change all calls to json_extract() into uses of the new ->> operator. ... (check-in: 50d433e5b0 user: drh tags: trunk) | |
|
2022-01-12
| ||
| 03:46 | sync.wiki: fixed a typo and struck allow-symlinks from the list of sync'd config options. ... (check-in: d1ac2f90da user: stephan tags: trunk) | |
Changes
Changes to auto.def.
| ︙ | ︙ | |||
31 32 33 34 35 36 37 |
no-opt=0 => {Build without optimization}
json=0 => {Build with fossil JSON API enabled}
}
# Update the minimum required SQLite version number here, and also
# in src/main.c near the sqlite3_libversion_number() call. Take care
# that both places agree!
| | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
no-opt=0 => {Build without optimization}
json=0 => {Build with fossil JSON API enabled}
}
# Update the minimum required SQLite version number here, and also
# in src/main.c near the sqlite3_libversion_number() call. Take care
# that both places agree!
define MINIMUM_SQLITE_VERSION "3.38.0"
# This is useful for people wanting Fossil to use an external SQLite library
# to compare the one they have against the minimum required
if {[opt-bool print-minimum-sqlite-version]} {
puts [get-define MINIMUM_SQLITE_VERSION]
exit 0
}
|
| ︙ | ︙ |
Changes to src/hook.c.
| ︙ | ︙ | |||
353 354 355 356 357 358 359 |
}else
if( strncmp(zCmd, "list", nCmd)==0 ){
Stmt q;
int n = 0;
verify_all_options();
db_prepare(&q,
"SELECT jx.key,"
| | | | | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
}else
if( strncmp(zCmd, "list", nCmd)==0 ){
Stmt q;
int n = 0;
verify_all_options();
db_prepare(&q,
"SELECT jx.key,"
" jx.value->>'seq',"
" jx.value->>'cmd',"
" jx.value->>'type'"
" FROM config, json_each(config.value) AS jx"
" WHERE config.name='hooks' AND json_valid(config.value)"
);
while( db_step(&q)==SQLITE_ROW ){
if( n++ ) fossil_print("\n");
fossil_print("%3d: type = %s\n",
db_column_int(&q,0), db_column_text(&q,3));
|
| ︙ | ︙ | |||
393 394 395 396 397 398 399 |
verify_all_options();
if( g.argc<4 ) usage("test ID");
id = atoi(g.argv[3]);
if( zOrigRcvid==0 ){
zOrigRcvid = db_text(0, "SELECT max(rcvid)-1 FROM rcvfrom");
}
db_prepare(&q,
| < | | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
verify_all_options();
if( g.argc<4 ) usage("test ID");
id = atoi(g.argv[3]);
if( zOrigRcvid==0 ){
zOrigRcvid = db_text(0, "SELECT max(rcvid)-1 FROM rcvfrom");
}
db_prepare(&q,
"SELECT value->>'$[%d].cmd', value->>'$[%d].type'=='after-receive'"
" FROM config"
" WHERE name='hooks' AND json_valid(value)",
id, id
);
while( db_step(&q)==SQLITE_ROW ){
const char *zCmd = db_column_text(&q,0);
char *zCmd2 = hook_subst(zCmd, zAuxFilename);
|
| ︙ | ︙ | |||
460 461 462 463 464 465 466 |
zLastRcvid = db_get("hook-last-rcvid","0");
zNewRcvid = db_text("0","SELECT max(rcvid) FROM rcvfrom");
if( atoi(zLastRcvid)>=atoi(zNewRcvid) ){
goto hook_backoffice_done; /* no new content */
}
blob_init(&chng, 0, 0);
db_prepare(&q,
| | | | | 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
zLastRcvid = db_get("hook-last-rcvid","0");
zNewRcvid = db_text("0","SELECT max(rcvid) FROM rcvfrom");
if( atoi(zLastRcvid)>=atoi(zNewRcvid) ){
goto hook_backoffice_done; /* no new content */
}
blob_init(&chng, 0, 0);
db_prepare(&q,
"SELECT jx.value->>'cmd'"
" FROM config, json_each(config.value) AS jx"
" WHERE config.name='hooks' AND json_valid(config.value)"
" AND jx.value->>'type'='after-receive'"
" ORDER BY jx.value->>'seq';"
);
while( db_step(&q)==SQLITE_ROW ){
char *zCmd;
int fdFromChild;
FILE *toChild;
int childPid;
if( cnt==0 ){
|
| ︙ | ︙ | |||
500 501 502 503 504 505 506 |
** Return true if one or more hooks of type zType exit.
*/
int hook_exists(const char *zType){
return db_exists(
"SELECT 1"
" FROM config, json_each(config.value) AS jx"
" WHERE config.name='hooks' AND json_valid(config.value)"
| | < | | | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
** Return true if one or more hooks of type zType exit.
*/
int hook_exists(const char *zType){
return db_exists(
"SELECT 1"
" FROM config, json_each(config.value) AS jx"
" WHERE config.name='hooks' AND json_valid(config.value)"
" AND jx.value->>'type'=%Q;",
zType
);
}
/*
** Run all hooks of type zType. Use zAuxFile as the auxiliary information
** file.
**
** If any hook returns non-zero, then stop running and return non-zero.
** Return zero only if all hooks return zero.
*/
int hook_run(const char *zType, const char *zAuxFile, int traceFlag){
Stmt q;
int rc = 0;
if( !db_exists("SELECT 1 FROM config WHERE name='hooks'") ){
return 0;
}
db_prepare(&q,
"SELECT jx.value->>'cmd' "
" FROM config, json_each(config.value) AS jx"
" WHERE config.name='hooks' AND json_valid(config.value)"
" AND jx.value->>'type'==%Q"
" ORDER BY jx.value->'seq';",
zType
);
while( db_step(&q)==SQLITE_ROW ){
char *zCmd;
zCmd = hook_subst(db_column_text(&q,0), zAuxFile);
if( traceFlag ){
fossil_print("%s hook: %s\n", zType, zCmd);
|
| ︙ | ︙ |
Changes to src/interwiki.c.
| ︙ | ︙ | |||
81 82 83 84 85 86 87 |
for(i=0; fossil_isalnum(zTarget[i]); i++){}
if( zTarget[i]!=':' ) return 0;
nCode = i;
if( nCode==4 && strncmp(zTarget,"wiki",4)==0 ) return 0;
zPage = zTarget + nCode + 1;
nPage = (int)strlen(zPage);
db_static_prepare(&q,
| | < < | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
for(i=0; fossil_isalnum(zTarget[i]); i++){}
if( zTarget[i]!=':' ) return 0;
nCode = i;
if( nCode==4 && strncmp(zTarget,"wiki",4)==0 ) return 0;
zPage = zTarget + nCode + 1;
nPage = (int)strlen(zPage);
db_static_prepare(&q,
"SELECT value->>'base', value->>'hash', value->>'wiki'"
" FROM config WHERE name=lower($name) AND json_valid(value)"
);
zName = mprintf("interwiki:%.*s", nCode, zTarget);
db_bind_text(&q, "$name", zName);
while( db_step(&q)==SQLITE_ROW ){
const char *zBase = db_column_text(&q,0);
if( zBase==0 || zBase[0]==0 ) break;
if( nPage==0 || zPage[0]=='/' ){
|
| ︙ | ︙ | |||
236 237 238 239 240 241 242 |
}else
if( strncmp(zCmd, "list", nCmd)==0 ){
Stmt q;
int n = 0;
verify_all_options();
db_prepare(&q,
"SELECT substr(name,11),"
| | < < | | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
}else
if( strncmp(zCmd, "list", nCmd)==0 ){
Stmt q;
int n = 0;
verify_all_options();
db_prepare(&q,
"SELECT substr(name,11),"
" value->>'base', value->>'hash', value->>'wiki'"
" FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zBase, *z, *zName;
if( n++ ) fossil_print("\n");
zName = db_column_text(&q,0);
zBase = db_column_text(&q,1);
fossil_print("%-15s %s\n", zName, zBase);
|
| ︙ | ︙ | |||
273 274 275 276 277 278 279 |
** Append text to the "Markdown" or "Wiki" rules pages that shows
** a table of all interwiki tags available on this system.
*/
void interwiki_append_map_table(Blob *out){
int n = 0;
Stmt q;
db_prepare(&q,
| | | | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
** Append text to the "Markdown" or "Wiki" rules pages that shows
** a table of all interwiki tags available on this system.
*/
void interwiki_append_map_table(Blob *out){
int n = 0;
Stmt q;
db_prepare(&q,
"SELECT substr(name,11), value->>'base'"
" FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
" ORDER BY name;"
);
while( db_step(&q)==SQLITE_ROW ){
if( n==0 ){
blob_appendf(out, "<blockquote><table>\n");
}
blob_appendf(out,"<tr><td>%h</td><td> → </td>",
|
| ︙ | ︙ | |||
350 351 352 353 354 355 356 |
@ <p>Interwiki links are hyperlink targets of the form
@ <blockquote><i>Tag</i><b>:</b><i>PageName</i></blockquote>
@ <p>Such links resolve to links to <i>PageName</i> on a separate server
@ identified by <i>Tag</i>. The Interwiki Map or "intermap" is a mapping
@ from <i>Tags</i> to complete Server URLs.
db_prepare(&q,
"SELECT substr(name,11),"
| | < < | | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
@ <p>Interwiki links are hyperlink targets of the form
@ <blockquote><i>Tag</i><b>:</b><i>PageName</i></blockquote>
@ <p>Such links resolve to links to <i>PageName</i> on a separate server
@ identified by <i>Tag</i>. The Interwiki Map or "intermap" is a mapping
@ from <i>Tags</i> to complete Server URLs.
db_prepare(&q,
"SELECT substr(name,11),"
" value->>'base', value->>'hash', value->>'wiki'"
" FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
);
while( db_step(&q)==SQLITE_ROW ){
if( n==0 ){
@ The current mapping is as follows:
@ <ol>
}
@ <li><p> %h(db_column_text(&q,0))
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
695 696 697 698 699 700 701 | fossil_printf_selfcheck(); fossil_limit_memory(1); /* When updating the minimum SQLite version, change the number here, ** and also MINIMUM_SQLITE_VERSION value set in ../auto.def. Take ** care that both places agree! */ | | > > | | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 |
fossil_printf_selfcheck();
fossil_limit_memory(1);
/* When updating the minimum SQLite version, change the number here,
** and also MINIMUM_SQLITE_VERSION value set in ../auto.def. Take
** care that both places agree! */
if( sqlite3_libversion_number()<3038000
|| strncmp(sqlite3_sourceid(),"2022-01-12",10)<0
){
fossil_panic("Unsuitable SQLite version %s, must be at least 3.38.0",
sqlite3_libversion());
}
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
memset(&g, 0, sizeof(g));
g.now = time(0);
|
| ︙ | ︙ |
Changes to src/stat.c.
| ︙ | ︙ | |||
607 608 609 610 611 612 613 |
}
cnt = 0;
db_prepare(&q,
"SELECT"
" substr(name,6),"
" datetime(mtime,'unixepoch'),"
| | | | 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 |
}
cnt = 0;
db_prepare(&q,
"SELECT"
" substr(name,6),"
" datetime(mtime,'unixepoch'),"
" value->>'type',"
" value->>'src'\n"
"FROM config\n"
"WHERE name GLOB 'link:*'\n"
"AND json_valid(value)\n"
"ORDER BY 4, 2 DESC"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zUrl = db_column_text(&q, 0);
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
1665 1666 1667 1668 1669 1670 1671 |
&& blob_is_hname(&xfer.aToken[2])
){
Stmt q;
sqlite3_int64 iNow = time(0);
sqlite3_int64 maxAge = db_get_int("lock-timeout",60);
int seenFault = 0;
db_prepare(&q,
| | | > | > | 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 |
&& blob_is_hname(&xfer.aToken[2])
){
Stmt q;
sqlite3_int64 iNow = time(0);
sqlite3_int64 maxAge = db_get_int("lock-timeout",60);
int seenFault = 0;
db_prepare(&q,
"SELECT value->>'login',"
" mtime,"
" value->>'clientid',"
" (SELECT rid FROM blob WHERE uuid=substr(name,9)),"
" name"
" FROM config"
" WHERE name GLOB 'ci-lock-*'"
" AND json_valid(value)"
);
while( db_step(&q)==SQLITE_ROW ){
int x = db_column_int(&q,3);
const char *zName = db_column_text(&q,4);
if( db_column_int64(&q,1)<=iNow-maxAge || !is_a_leaf(x) ){
/* check-in locks expire after maxAge seconds, or when the
** check-in is no longer a leaf */
|
| ︙ | ︙ | |||
1723 1724 1725 1726 1727 1728 1729 |
&& xfer.nToken==3
&& blob_is_hname(&xfer.aToken[2])
){
db_unprotect(PROTECT_CONFIG);
db_multi_exec(
"DELETE FROM config"
" WHERE name GLOB 'ci-lock-*'"
| | | 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 |
&& xfer.nToken==3
&& blob_is_hname(&xfer.aToken[2])
){
db_unprotect(PROTECT_CONFIG);
db_multi_exec(
"DELETE FROM config"
" WHERE name GLOB 'ci-lock-*'"
" AND (NOT json_valid(value) OR value->>'clientid'==%Q)",
blob_str(&xfer.aToken[2])
);
db_protect_pop();
}else
/* pragma client-url URL
**
|
| ︙ | ︙ |