Fossil SCM
Rebuild ticket tables when modifications are made using 'fossil config'.
Commit
0047370ce670cd77ab756826a4445c2ef8e84106
Parent
38c02b775d75c1f…
2 files changed
+18
+1
+18
| --- src/configure.c | ||
| +++ src/configure.c | ||
| @@ -400,10 +400,25 @@ | ||
| 400 | 400 | @ DROP TABLE _xfer_user; |
| 401 | 401 | @ DROP TABLE _xfer_reportfmt; |
| 402 | 402 | ; |
| 403 | 403 | db_multi_exec(zSQL); |
| 404 | 404 | } |
| 405 | + | |
| 406 | +/* | |
| 407 | +** Mask of modified configuration sets | |
| 408 | +*/ | |
| 409 | +static int rebuildMask = 0; | |
| 410 | + | |
| 411 | +/* | |
| 412 | +** Rebuild auxiliary tables as required by configuration changes. | |
| 413 | +*/ | |
| 414 | +void configure_rebuild(void){ | |
| 415 | + if( rebuildMask & CONFIGSET_TKT ){ | |
| 416 | + ticket_rebuild(); | |
| 417 | + } | |
| 418 | + rebuildMask = 0; | |
| 419 | +} | |
| 405 | 420 | |
| 406 | 421 | /* |
| 407 | 422 | ** Return true if z[] is not a "safe" SQL token. A safe token is one of: |
| 408 | 423 | ** |
| 409 | 424 | ** * A string literal |
| @@ -566,10 +581,11 @@ | ||
| 566 | 581 | blob_appendf(&sql, " WHERE %s=%s AND mtime<%s", |
| 567 | 582 | aType[ii].zPrimKey, azToken[1], azToken[0]); |
| 568 | 583 | db_multi_exec("%s", blob_str(&sql)); |
| 569 | 584 | } |
| 570 | 585 | blob_reset(&sql); |
| 586 | + rebuildMask |= thisMask; | |
| 571 | 587 | }else{ |
| 572 | 588 | /* Otherwise, the old format */ |
| 573 | 589 | if( (configure_is_exportable(zName) & groupMask)==0 ) return; |
| 574 | 590 | if( fossil_strcmp(zName, "logo-image")==0 ){ |
| 575 | 591 | Stmt ins; |
| @@ -948,11 +964,13 @@ | ||
| 948 | 964 | } |
| 949 | 965 | db_end_transaction(0); |
| 950 | 966 | fossil_print("Configuration reset to factory defaults.\n"); |
| 951 | 967 | fossil_print("To recover, use: %s %s import %s\n", |
| 952 | 968 | g.argv[0], g.argv[1], zBackup); |
| 969 | + rebuildMask |= mask; | |
| 953 | 970 | }else |
| 954 | 971 | { |
| 955 | 972 | fossil_fatal("METHOD should be one of:" |
| 956 | 973 | " export import merge pull push reset"); |
| 957 | 974 | } |
| 975 | + configure_rebuild(); | |
| 958 | 976 | } |
| 959 | 977 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -400,10 +400,25 @@ | |
| 400 | @ DROP TABLE _xfer_user; |
| 401 | @ DROP TABLE _xfer_reportfmt; |
| 402 | ; |
| 403 | db_multi_exec(zSQL); |
| 404 | } |
| 405 | |
| 406 | /* |
| 407 | ** Return true if z[] is not a "safe" SQL token. A safe token is one of: |
| 408 | ** |
| 409 | ** * A string literal |
| @@ -566,10 +581,11 @@ | |
| 566 | blob_appendf(&sql, " WHERE %s=%s AND mtime<%s", |
| 567 | aType[ii].zPrimKey, azToken[1], azToken[0]); |
| 568 | db_multi_exec("%s", blob_str(&sql)); |
| 569 | } |
| 570 | blob_reset(&sql); |
| 571 | }else{ |
| 572 | /* Otherwise, the old format */ |
| 573 | if( (configure_is_exportable(zName) & groupMask)==0 ) return; |
| 574 | if( fossil_strcmp(zName, "logo-image")==0 ){ |
| 575 | Stmt ins; |
| @@ -948,11 +964,13 @@ | |
| 948 | } |
| 949 | db_end_transaction(0); |
| 950 | fossil_print("Configuration reset to factory defaults.\n"); |
| 951 | fossil_print("To recover, use: %s %s import %s\n", |
| 952 | g.argv[0], g.argv[1], zBackup); |
| 953 | }else |
| 954 | { |
| 955 | fossil_fatal("METHOD should be one of:" |
| 956 | " export import merge pull push reset"); |
| 957 | } |
| 958 | } |
| 959 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -400,10 +400,25 @@ | |
| 400 | @ DROP TABLE _xfer_user; |
| 401 | @ DROP TABLE _xfer_reportfmt; |
| 402 | ; |
| 403 | db_multi_exec(zSQL); |
| 404 | } |
| 405 | |
| 406 | /* |
| 407 | ** Mask of modified configuration sets |
| 408 | */ |
| 409 | static int rebuildMask = 0; |
| 410 | |
| 411 | /* |
| 412 | ** Rebuild auxiliary tables as required by configuration changes. |
| 413 | */ |
| 414 | void configure_rebuild(void){ |
| 415 | if( rebuildMask & CONFIGSET_TKT ){ |
| 416 | ticket_rebuild(); |
| 417 | } |
| 418 | rebuildMask = 0; |
| 419 | } |
| 420 | |
| 421 | /* |
| 422 | ** Return true if z[] is not a "safe" SQL token. A safe token is one of: |
| 423 | ** |
| 424 | ** * A string literal |
| @@ -566,10 +581,11 @@ | |
| 581 | blob_appendf(&sql, " WHERE %s=%s AND mtime<%s", |
| 582 | aType[ii].zPrimKey, azToken[1], azToken[0]); |
| 583 | db_multi_exec("%s", blob_str(&sql)); |
| 584 | } |
| 585 | blob_reset(&sql); |
| 586 | rebuildMask |= thisMask; |
| 587 | }else{ |
| 588 | /* Otherwise, the old format */ |
| 589 | if( (configure_is_exportable(zName) & groupMask)==0 ) return; |
| 590 | if( fossil_strcmp(zName, "logo-image")==0 ){ |
| 591 | Stmt ins; |
| @@ -948,11 +964,13 @@ | |
| 964 | } |
| 965 | db_end_transaction(0); |
| 966 | fossil_print("Configuration reset to factory defaults.\n"); |
| 967 | fossil_print("To recover, use: %s %s import %s\n", |
| 968 | g.argv[0], g.argv[1], zBackup); |
| 969 | rebuildMask |= mask; |
| 970 | }else |
| 971 | { |
| 972 | fossil_fatal("METHOD should be one of:" |
| 973 | " export import merge pull push reset"); |
| 974 | } |
| 975 | configure_rebuild(); |
| 976 | } |
| 977 |
+1
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1267,10 +1267,11 @@ | ||
| 1267 | 1267 | zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')"); |
| 1268 | 1268 | @ # timestamp %s(zNow) |
| 1269 | 1269 | free(zNow); |
| 1270 | 1270 | |
| 1271 | 1271 | db_end_transaction(0); |
| 1272 | + configure_rebuild(); | |
| 1272 | 1273 | } |
| 1273 | 1274 | |
| 1274 | 1275 | /* |
| 1275 | 1276 | ** COMMAND: test-xfer |
| 1276 | 1277 | ** |
| 1277 | 1278 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1267,10 +1267,11 @@ | |
| 1267 | zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')"); |
| 1268 | @ # timestamp %s(zNow) |
| 1269 | free(zNow); |
| 1270 | |
| 1271 | db_end_transaction(0); |
| 1272 | } |
| 1273 | |
| 1274 | /* |
| 1275 | ** COMMAND: test-xfer |
| 1276 | ** |
| 1277 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1267,10 +1267,11 @@ | |
| 1267 | zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')"); |
| 1268 | @ # timestamp %s(zNow) |
| 1269 | free(zNow); |
| 1270 | |
| 1271 | db_end_transaction(0); |
| 1272 | configure_rebuild(); |
| 1273 | } |
| 1274 | |
| 1275 | /* |
| 1276 | ** COMMAND: test-xfer |
| 1277 | ** |
| 1278 |