Fossil SCM
More legacy configuration sync code removed.
Commit
fe7f0ece30019cb910bc3d6d4a155ea8515a42752c9476c45edb3a9e2facb3d6
Parent
2ed7c1123d055ea…
2 files changed
-55
-31
-55
| --- src/configure.c | ||
| +++ src/configure.c | ||
| @@ -236,65 +236,10 @@ | ||
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | return 0; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | -/* | |
| 242 | -** zName is one of the special configuration names that refers to an entire | |
| 243 | -** table rather than a single entry in CONFIG. Special names are "@reportfmt" | |
| 244 | -** and "@shun" and "@user". This routine writes SQL text into pOut that when | |
| 245 | -** evaluated will populate the corresponding table with data. | |
| 246 | -*/ | |
| 247 | -void configure_render_special_name(const char *zName, Blob *pOut){ | |
| 248 | - Stmt q; | |
| 249 | - if( fossil_strcmp(zName, "@shun")==0 ){ | |
| 250 | - db_prepare(&q, "SELECT uuid FROM shun"); | |
| 251 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 252 | - blob_appendf(pOut, "INSERT OR IGNORE INTO shun VALUES('%s');\n", | |
| 253 | - db_column_text(&q, 0) | |
| 254 | - ); | |
| 255 | - } | |
| 256 | - db_finalize(&q); | |
| 257 | - }else if( fossil_strcmp(zName, "@reportfmt")==0 ){ | |
| 258 | - db_prepare(&q, "SELECT title, cols, sqlcode FROM reportfmt"); | |
| 259 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 260 | - blob_appendf(pOut, "INSERT INTO _xfer_reportfmt(title,cols,sqlcode)" | |
| 261 | - " VALUES(%Q,%Q,%Q);\n", | |
| 262 | - db_column_text(&q, 0), | |
| 263 | - db_column_text(&q, 1), | |
| 264 | - db_column_text(&q, 2) | |
| 265 | - ); | |
| 266 | - } | |
| 267 | - db_finalize(&q); | |
| 268 | - }else if( fossil_strcmp(zName, "@user")==0 ){ | |
| 269 | - db_prepare(&q, | |
| 270 | - "SELECT login, CASE WHEN length(pw)==40 THEN pw END," | |
| 271 | - " cap, info, quote(photo) FROM user"); | |
| 272 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 273 | - blob_appendf(pOut, "INSERT INTO _xfer_user(login,pw,cap,info,photo)" | |
| 274 | - " VALUES(%Q,%Q,%Q,%Q,%s);\n", | |
| 275 | - db_column_text(&q, 0), | |
| 276 | - db_column_text(&q, 1), | |
| 277 | - db_column_text(&q, 2), | |
| 278 | - db_column_text(&q, 3), | |
| 279 | - db_column_text(&q, 4) | |
| 280 | - ); | |
| 281 | - } | |
| 282 | - db_finalize(&q); | |
| 283 | - }else if( fossil_strcmp(zName, "@concealed")==0 ){ | |
| 284 | - db_prepare(&q, "SELECT hash, content FROM concealed"); | |
| 285 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 286 | - blob_appendf(pOut, "INSERT OR IGNORE INTO concealed(hash,content)" | |
| 287 | - " VALUES(%Q,%Q);\n", | |
| 288 | - db_column_text(&q, 0), | |
| 289 | - db_column_text(&q, 1) | |
| 290 | - ); | |
| 291 | - } | |
| 292 | - db_finalize(&q); | |
| 293 | - } | |
| 294 | -} | |
| 295 | - | |
| 296 | 241 | /* |
| 297 | 242 | ** Two SQL functions: |
| 298 | 243 | ** |
| 299 | 244 | ** config_is_reset(int) |
| 300 | 245 | ** config_reset(int) |
| 301 | 246 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -236,65 +236,10 @@ | |
| 236 | } |
| 237 | } |
| 238 | return 0; |
| 239 | } |
| 240 | |
| 241 | /* |
| 242 | ** zName is one of the special configuration names that refers to an entire |
| 243 | ** table rather than a single entry in CONFIG. Special names are "@reportfmt" |
| 244 | ** and "@shun" and "@user". This routine writes SQL text into pOut that when |
| 245 | ** evaluated will populate the corresponding table with data. |
| 246 | */ |
| 247 | void configure_render_special_name(const char *zName, Blob *pOut){ |
| 248 | Stmt q; |
| 249 | if( fossil_strcmp(zName, "@shun")==0 ){ |
| 250 | db_prepare(&q, "SELECT uuid FROM shun"); |
| 251 | while( db_step(&q)==SQLITE_ROW ){ |
| 252 | blob_appendf(pOut, "INSERT OR IGNORE INTO shun VALUES('%s');\n", |
| 253 | db_column_text(&q, 0) |
| 254 | ); |
| 255 | } |
| 256 | db_finalize(&q); |
| 257 | }else if( fossil_strcmp(zName, "@reportfmt")==0 ){ |
| 258 | db_prepare(&q, "SELECT title, cols, sqlcode FROM reportfmt"); |
| 259 | while( db_step(&q)==SQLITE_ROW ){ |
| 260 | blob_appendf(pOut, "INSERT INTO _xfer_reportfmt(title,cols,sqlcode)" |
| 261 | " VALUES(%Q,%Q,%Q);\n", |
| 262 | db_column_text(&q, 0), |
| 263 | db_column_text(&q, 1), |
| 264 | db_column_text(&q, 2) |
| 265 | ); |
| 266 | } |
| 267 | db_finalize(&q); |
| 268 | }else if( fossil_strcmp(zName, "@user")==0 ){ |
| 269 | db_prepare(&q, |
| 270 | "SELECT login, CASE WHEN length(pw)==40 THEN pw END," |
| 271 | " cap, info, quote(photo) FROM user"); |
| 272 | while( db_step(&q)==SQLITE_ROW ){ |
| 273 | blob_appendf(pOut, "INSERT INTO _xfer_user(login,pw,cap,info,photo)" |
| 274 | " VALUES(%Q,%Q,%Q,%Q,%s);\n", |
| 275 | db_column_text(&q, 0), |
| 276 | db_column_text(&q, 1), |
| 277 | db_column_text(&q, 2), |
| 278 | db_column_text(&q, 3), |
| 279 | db_column_text(&q, 4) |
| 280 | ); |
| 281 | } |
| 282 | db_finalize(&q); |
| 283 | }else if( fossil_strcmp(zName, "@concealed")==0 ){ |
| 284 | db_prepare(&q, "SELECT hash, content FROM concealed"); |
| 285 | while( db_step(&q)==SQLITE_ROW ){ |
| 286 | blob_appendf(pOut, "INSERT OR IGNORE INTO concealed(hash,content)" |
| 287 | " VALUES(%Q,%Q);\n", |
| 288 | db_column_text(&q, 0), |
| 289 | db_column_text(&q, 1) |
| 290 | ); |
| 291 | } |
| 292 | db_finalize(&q); |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | /* |
| 297 | ** Two SQL functions: |
| 298 | ** |
| 299 | ** config_is_reset(int) |
| 300 | ** config_reset(int) |
| 301 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -236,65 +236,10 @@ | |
| 236 | } |
| 237 | } |
| 238 | return 0; |
| 239 | } |
| 240 | |
| 241 | /* |
| 242 | ** Two SQL functions: |
| 243 | ** |
| 244 | ** config_is_reset(int) |
| 245 | ** config_reset(int) |
| 246 |
-31
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1006,38 +1006,10 @@ | ||
| 1006 | 1006 | while( db_step(&q)==SQLITE_ROW ){ |
| 1007 | 1007 | blob_appendf(pXfer->pOut, "igot %s\n", db_column_text(&q, 0)); |
| 1008 | 1008 | } |
| 1009 | 1009 | db_finalize(&q); |
| 1010 | 1010 | } |
| 1011 | - | |
| 1012 | -/* | |
| 1013 | -** Send a single old-style config card for configuration item zName. | |
| 1014 | -** | |
| 1015 | -** This routine and the functionality it implements is scheduled for | |
| 1016 | -** removal on 2012-05-01. | |
| 1017 | -*/ | |
| 1018 | -static void send_legacy_config_card(Xfer *pXfer, const char *zName){ | |
| 1019 | - if( zName[0]!='@' ){ | |
| 1020 | - Blob val; | |
| 1021 | - blob_zero(&val); | |
| 1022 | - db_blob(&val, "SELECT value FROM config WHERE name=%Q", zName); | |
| 1023 | - if( blob_size(&val)>0 ){ | |
| 1024 | - blob_appendf(pXfer->pOut, "config %s %d\n", zName, blob_size(&val)); | |
| 1025 | - blob_append(pXfer->pOut, blob_buffer(&val), blob_size(&val)); | |
| 1026 | - blob_reset(&val); | |
| 1027 | - blob_append(pXfer->pOut, "\n", 1); | |
| 1028 | - } | |
| 1029 | - }else{ | |
| 1030 | - Blob content; | |
| 1031 | - blob_zero(&content); | |
| 1032 | - configure_render_special_name(zName, &content); | |
| 1033 | - blob_appendf(pXfer->pOut, "config %s %d\n%s\n", zName, | |
| 1034 | - blob_size(&content), blob_str(&content)); | |
| 1035 | - blob_reset(&content); | |
| 1036 | - } | |
| 1037 | -} | |
| 1038 | - | |
| 1039 | 1011 | |
| 1040 | 1012 | /* |
| 1041 | 1013 | ** pXfer is a "pragma uv-hash HASH" card. |
| 1042 | 1014 | ** |
| 1043 | 1015 | ** If HASH is different from the unversioned content hash on this server, |
| @@ -1452,13 +1424,10 @@ | ||
| 1452 | 1424 | /* New style configuration transfer */ |
| 1453 | 1425 | int groupMask = configure_name_to_mask(&zName[1], 0); |
| 1454 | 1426 | if( !g.perm.Admin ) groupMask &= ~CONFIGSET_USER; |
| 1455 | 1427 | if( !g.perm.RdAddr ) groupMask &= ~CONFIGSET_ADDR; |
| 1456 | 1428 | configure_send_group(xfer.pOut, groupMask, 0); |
| 1457 | - }else if( configure_is_exportable(zName) ){ | |
| 1458 | - /* Old style configuration transfer */ | |
| 1459 | - send_legacy_config_card(&xfer, zName); | |
| 1460 | 1429 | } |
| 1461 | 1430 | } |
| 1462 | 1431 | }else |
| 1463 | 1432 | |
| 1464 | 1433 | /* config NAME SIZE \n CONTENT |
| 1465 | 1434 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1006,38 +1006,10 @@ | |
| 1006 | while( db_step(&q)==SQLITE_ROW ){ |
| 1007 | blob_appendf(pXfer->pOut, "igot %s\n", db_column_text(&q, 0)); |
| 1008 | } |
| 1009 | db_finalize(&q); |
| 1010 | } |
| 1011 | |
| 1012 | /* |
| 1013 | ** Send a single old-style config card for configuration item zName. |
| 1014 | ** |
| 1015 | ** This routine and the functionality it implements is scheduled for |
| 1016 | ** removal on 2012-05-01. |
| 1017 | */ |
| 1018 | static void send_legacy_config_card(Xfer *pXfer, const char *zName){ |
| 1019 | if( zName[0]!='@' ){ |
| 1020 | Blob val; |
| 1021 | blob_zero(&val); |
| 1022 | db_blob(&val, "SELECT value FROM config WHERE name=%Q", zName); |
| 1023 | if( blob_size(&val)>0 ){ |
| 1024 | blob_appendf(pXfer->pOut, "config %s %d\n", zName, blob_size(&val)); |
| 1025 | blob_append(pXfer->pOut, blob_buffer(&val), blob_size(&val)); |
| 1026 | blob_reset(&val); |
| 1027 | blob_append(pXfer->pOut, "\n", 1); |
| 1028 | } |
| 1029 | }else{ |
| 1030 | Blob content; |
| 1031 | blob_zero(&content); |
| 1032 | configure_render_special_name(zName, &content); |
| 1033 | blob_appendf(pXfer->pOut, "config %s %d\n%s\n", zName, |
| 1034 | blob_size(&content), blob_str(&content)); |
| 1035 | blob_reset(&content); |
| 1036 | } |
| 1037 | } |
| 1038 | |
| 1039 | |
| 1040 | /* |
| 1041 | ** pXfer is a "pragma uv-hash HASH" card. |
| 1042 | ** |
| 1043 | ** If HASH is different from the unversioned content hash on this server, |
| @@ -1452,13 +1424,10 @@ | |
| 1452 | /* New style configuration transfer */ |
| 1453 | int groupMask = configure_name_to_mask(&zName[1], 0); |
| 1454 | if( !g.perm.Admin ) groupMask &= ~CONFIGSET_USER; |
| 1455 | if( !g.perm.RdAddr ) groupMask &= ~CONFIGSET_ADDR; |
| 1456 | configure_send_group(xfer.pOut, groupMask, 0); |
| 1457 | }else if( configure_is_exportable(zName) ){ |
| 1458 | /* Old style configuration transfer */ |
| 1459 | send_legacy_config_card(&xfer, zName); |
| 1460 | } |
| 1461 | } |
| 1462 | }else |
| 1463 | |
| 1464 | /* config NAME SIZE \n CONTENT |
| 1465 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1006,38 +1006,10 @@ | |
| 1006 | while( db_step(&q)==SQLITE_ROW ){ |
| 1007 | blob_appendf(pXfer->pOut, "igot %s\n", db_column_text(&q, 0)); |
| 1008 | } |
| 1009 | db_finalize(&q); |
| 1010 | } |
| 1011 | |
| 1012 | /* |
| 1013 | ** pXfer is a "pragma uv-hash HASH" card. |
| 1014 | ** |
| 1015 | ** If HASH is different from the unversioned content hash on this server, |
| @@ -1452,13 +1424,10 @@ | |
| 1424 | /* New style configuration transfer */ |
| 1425 | int groupMask = configure_name_to_mask(&zName[1], 0); |
| 1426 | if( !g.perm.Admin ) groupMask &= ~CONFIGSET_USER; |
| 1427 | if( !g.perm.RdAddr ) groupMask &= ~CONFIGSET_ADDR; |
| 1428 | configure_send_group(xfer.pOut, groupMask, 0); |
| 1429 | } |
| 1430 | } |
| 1431 | }else |
| 1432 | |
| 1433 | /* config NAME SIZE \n CONTENT |
| 1434 |