| | @@ -57,11 +57,11 @@ |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | /* |
| 61 | 61 | ** The following is a list of settings that we are willing to |
| 62 | | -** transfer. |
| 62 | +** transfer. |
| 63 | 63 | ** |
| 64 | 64 | ** Setting names that begin with an alphabetic characters refer to |
| 65 | 65 | ** single entries in the CONFIG table. Setting names that begin with |
| 66 | 66 | ** "@" are for special processing. |
| 67 | 67 | */ |
| | @@ -147,28 +147,28 @@ |
| 147 | 147 | void configure_render_special_name(const char *zName, Blob *pOut){ |
| 148 | 148 | Stmt q; |
| 149 | 149 | if( fossil_strcmp(zName, "@shun")==0 ){ |
| 150 | 150 | db_prepare(&q, "SELECT uuid FROM shun"); |
| 151 | 151 | while( db_step(&q)==SQLITE_ROW ){ |
| 152 | | - blob_appendf(pOut, "INSERT OR IGNORE INTO shun VALUES('%s');\n", |
| 152 | + blob_appendf(pOut, "INSERT OR IGNORE INTO shun VALUES('%s');\n", |
| 153 | 153 | db_column_text(&q, 0) |
| 154 | 154 | ); |
| 155 | 155 | } |
| 156 | 156 | db_finalize(&q); |
| 157 | 157 | }else if( fossil_strcmp(zName, "@reportfmt")==0 ){ |
| 158 | 158 | db_prepare(&q, "SELECT title, cols, sqlcode FROM reportfmt"); |
| 159 | 159 | while( db_step(&q)==SQLITE_ROW ){ |
| 160 | 160 | blob_appendf(pOut, "INSERT INTO _xfer_reportfmt(title,cols,sqlcode)" |
| 161 | | - " VALUES(%Q,%Q,%Q);\n", |
| 161 | + " VALUES(%Q,%Q,%Q);\n", |
| 162 | 162 | db_column_text(&q, 0), |
| 163 | 163 | db_column_text(&q, 1), |
| 164 | 164 | db_column_text(&q, 2) |
| 165 | 165 | ); |
| 166 | 166 | } |
| 167 | 167 | db_finalize(&q); |
| 168 | 168 | }else if( fossil_strcmp(zName, "@user")==0 ){ |
| 169 | | - db_prepare(&q, |
| 169 | + db_prepare(&q, |
| 170 | 170 | "SELECT login, CASE WHEN length(pw)==40 THEN pw END," |
| 171 | 171 | " cap, info, quote(photo) FROM user"); |
| 172 | 172 | while( db_step(&q)==SQLITE_ROW ){ |
| 173 | 173 | blob_appendf(pOut, "INSERT INTO _xfer_user(login,pw,cap,info,photo)" |
| 174 | 174 | " VALUES(%Q,%Q,%Q,%Q,%s);\n", |
| | @@ -259,11 +259,11 @@ |
| 259 | 259 | @ ); |
| 260 | 260 | @ INSERT INTO _xfer_reportfmt SELECT * FROM reportfmt; |
| 261 | 261 | @ INSERT INTO _xfer_user SELECT * FROM user; |
| 262 | 262 | ; |
| 263 | 263 | db_multi_exec(zSQL1); |
| 264 | | - |
| 264 | + |
| 265 | 265 | /* When the replace flag is set, add triggers that run the first time |
| 266 | 266 | ** that new data is seen. The triggers run only once and delete all the |
| 267 | 267 | ** existing data. |
| 268 | 268 | */ |
| 269 | 269 | if( replaceFlag ){ |
| | @@ -339,11 +339,11 @@ |
| 339 | 339 | const char *zFilename /* Write into this file */ |
| 340 | 340 | ){ |
| 341 | 341 | int i; |
| 342 | 342 | Blob out; |
| 343 | 343 | blob_zero(&out); |
| 344 | | - blob_appendf(&out, |
| 344 | + blob_appendf(&out, |
| 345 | 345 | "-- The \"%s\" configuration exported from\n" |
| 346 | 346 | "-- repository \"%s\"\n" |
| 347 | 347 | "-- on %s\n", |
| 348 | 348 | zMask, g.zRepositoryName, |
| 349 | 349 | db_text(0, "SELECT datetime('now')") |
| | @@ -350,14 +350,14 @@ |
| 350 | 350 | ); |
| 351 | 351 | for(i=0; i<count(aConfig); i++){ |
| 352 | 352 | if( (aConfig[i].groupMask & mask)!=0 ){ |
| 353 | 353 | const char *zName = aConfig[i].zName; |
| 354 | 354 | if( zName[0]!='@' ){ |
| 355 | | - char *zValue = db_text(0, |
| 355 | + char *zValue = db_text(0, |
| 356 | 356 | "SELECT quote(value) FROM config WHERE name=%Q", zName); |
| 357 | 357 | if( zValue ){ |
| 358 | | - blob_appendf(&out,"REPLACE INTO config VALUES(%Q,%s);\n", |
| 358 | + blob_appendf(&out,"REPLACE INTO config VALUES(%Q,%s);\n", |
| 359 | 359 | zName, zValue); |
| 360 | 360 | } |
| 361 | 361 | free(zValue); |
| 362 | 362 | }else{ |
| 363 | 363 | configure_render_special_name(zName, &out); |
| | @@ -395,11 +395,11 @@ |
| 395 | 395 | ** |
| 396 | 396 | ** %fossil configuration pull AREA ?URL? |
| 397 | 397 | ** |
| 398 | 398 | ** Pull and install the configuration from a different server |
| 399 | 399 | ** identified by URL. If no URL is specified, then the default |
| 400 | | -** server is used. |
| 400 | +** server is used. |
| 401 | 401 | ** |
| 402 | 402 | ** %fossil configuration push AREA ?URL? |
| 403 | 403 | ** |
| 404 | 404 | ** Push the local configuration into the remote server identified |
| 405 | 405 | ** by URL. Admin privilege is required on the remote server for |
| | @@ -410,10 +410,26 @@ |
| 410 | 410 | ** Restore the configuration to the default. AREA as above. |
| 411 | 411 | ** |
| 412 | 412 | ** WARNING: Do not import, merge, or pull configurations from an untrusted |
| 413 | 413 | ** source. The inbound configuration is not checked for safety and can |
| 414 | 414 | ** introduce security vulnerabilities. |
| 415 | +** |
| 416 | +** |
| 417 | +** SUMMARY: fossil configure METHOD ... ?-R|--repository REPOSITORY? |
| 418 | +** Where: METHOD = export, import, merge, pull, push or reset |
| 419 | +** |
| 420 | +** For methods export, pull, push and reset: |
| 421 | +** |
| 422 | +** fossil configure METHOD AREA ?FILENAME|URL? ?-R|--repository REPOSITORY? |
| 423 | +** |
| 424 | +** AREA = all email project shun skin ticket user |
| 425 | +** |
| 426 | +** FILENAME used with methods export, URL used with the others |
| 427 | +** |
| 428 | +** For methods import and merge |
| 429 | +** |
| 430 | +** fossil configure METHOD FILENAME -R|--repository REPOSITORY? |
| 415 | 431 | */ |
| 416 | 432 | void configuration_cmd(void){ |
| 417 | 433 | int n; |
| 418 | 434 | const char *zMethod; |
| 419 | 435 | if( g.argc<3 ){ |
| | @@ -428,11 +444,11 @@ |
| 428 | 444 | usage("export AREA FILENAME"); |
| 429 | 445 | } |
| 430 | 446 | mask = find_area(g.argv[3]); |
| 431 | 447 | export_config(mask, g.argv[3], g.argv[4]); |
| 432 | 448 | }else |
| 433 | | - if( strncmp(zMethod, "import", n)==0 |
| 449 | + if( strncmp(zMethod, "import", n)==0 |
| 434 | 450 | || strncmp(zMethod, "merge", n)==0 ){ |
| 435 | 451 | Blob in; |
| 436 | 452 | if( g.argc!=4 ) usage(mprintf("%s FILENAME",zMethod)); |
| 437 | 453 | blob_read_from_file(&in, g.argv[3]); |
| 438 | 454 | db_begin_transaction(); |
| | @@ -474,11 +490,11 @@ |
| 474 | 490 | if( strncmp(zMethod, "reset", n)==0 ){ |
| 475 | 491 | int mask, i; |
| 476 | 492 | char *zBackup; |
| 477 | 493 | if( g.argc!=4 ) usage("reset AREA"); |
| 478 | 494 | mask = find_area(g.argv[3]); |
| 479 | | - zBackup = db_text(0, |
| 495 | + zBackup = db_text(0, |
| 480 | 496 | "SELECT strftime('config-backup-%%Y%%m%%d%%H%%M%%f','now')"); |
| 481 | 497 | db_begin_transaction(); |
| 482 | 498 | export_config(mask, g.argv[3], zBackup); |
| 483 | 499 | for(i=0; i<count(aConfig); i++){ |
| 484 | 500 | const char *zName = aConfig[i].zName; |
| | @@ -496,13 +512,13 @@ |
| 496 | 512 | db_multi_exec("DELETE FROM reportfmt"); |
| 497 | 513 | } |
| 498 | 514 | } |
| 499 | 515 | db_end_transaction(0); |
| 500 | 516 | printf("Configuration reset to factory defaults.\n"); |
| 501 | | - printf("To recover, use: %s %s import %s\n", |
| 517 | + printf("To recover, use: %s %s import %s\n", |
| 502 | 518 | fossil_nameofexe(), g.argv[1], zBackup); |
| 503 | 519 | }else |
| 504 | 520 | { |
| 505 | 521 | fossil_fatal("METHOD should be one of:" |
| 506 | 522 | " export import merge pull push reset"); |
| 507 | 523 | } |
| 508 | 524 | } |
| 509 | 525 | |