Fossil SCM
Remove still more legacy configuration sync logic.
Commit
9a68e6e1b0dd26cbc579bccc49468ca741af545b7bbc3680278d1574e491095c
Parent
3d36a37a738a21c…
2 files changed
-88
-8
-88
| --- src/configure.c | ||
| +++ src/configure.c | ||
| @@ -274,98 +274,10 @@ | ||
| 274 | 274 | ){ |
| 275 | 275 | int m = sqlite3_value_int(argv[0]); |
| 276 | 276 | configHasBeenReset |= m; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | -/* | |
| 280 | -** Create the temporary _xfer_reportfmt and _xfer_user tables that are | |
| 281 | -** necessary in order to evaluate the SQL text generated by the | |
| 282 | -** configure_render_special_name() routine. | |
| 283 | -** | |
| 284 | -** If replaceFlag is true, then the setup is such that the content in | |
| 285 | -** the SQL text will completely replace the current repository configuration. | |
| 286 | -** If replaceFlag is false, then the SQL text will be merged with the | |
| 287 | -** existing configuration. When merging, existing values take priority | |
| 288 | -** over SQL text values. | |
| 289 | -*/ | |
| 290 | -void configure_prepare_to_receive(int replaceFlag){ | |
| 291 | - static const char zSQL1[] = | |
| 292 | - @ CREATE TEMP TABLE _xfer_reportfmt( | |
| 293 | - @ rn integer primary key, -- Report number | |
| 294 | - @ owner text, -- Owner of this report format (not used) | |
| 295 | - @ title text UNIQUE ON CONFLICT IGNORE, -- Title of this report | |
| 296 | - @ cols text, -- A color-key specification | |
| 297 | - @ sqlcode text -- An SQL SELECT statement for this report | |
| 298 | - @ ); | |
| 299 | - @ CREATE TEMP TABLE _xfer_user( | |
| 300 | - @ uid INTEGER PRIMARY KEY, -- User ID | |
| 301 | - @ login TEXT UNIQUE ON CONFLICT IGNORE, -- login name of the user | |
| 302 | - @ pw TEXT, -- password | |
| 303 | - @ cap TEXT, -- Capabilities of this user | |
| 304 | - @ cookie TEXT, -- WWW login cookie | |
| 305 | - @ ipaddr TEXT, -- IP address for which cookie is valid | |
| 306 | - @ cexpire DATETIME, -- Time when cookie expires | |
| 307 | - @ info TEXT, -- contact information | |
| 308 | - @ photo BLOB -- JPEG image of this user | |
| 309 | - @ ); | |
| 310 | - @ INSERT INTO _xfer_reportfmt | |
| 311 | - @ SELECT rn,owner,title,cols,sqlcode FROM reportfmt; | |
| 312 | - @ INSERT INTO _xfer_user | |
| 313 | - @ SELECT uid,login,pw,cap,cookie,ipaddr,cexpire,info,photo FROM user; | |
| 314 | - ; | |
| 315 | - assert( strchr(zSQL1,'%')==0 ); | |
| 316 | - db_multi_exec(zSQL1 /*works-like:""*/); | |
| 317 | - | |
| 318 | - /* When the replace flag is set, add triggers that run the first time | |
| 319 | - ** that new data is seen. The triggers run only once and delete all the | |
| 320 | - ** existing data. | |
| 321 | - */ | |
| 322 | - if( replaceFlag ){ | |
| 323 | - static const char zSQL2[] = | |
| 324 | - @ CREATE TRIGGER _xfer_r1 BEFORE INSERT ON _xfer_reportfmt | |
| 325 | - @ WHEN NOT config_is_reset(2) BEGIN | |
| 326 | - @ DELETE FROM _xfer_reportfmt; | |
| 327 | - @ SELECT config_reset(2); | |
| 328 | - @ END; | |
| 329 | - @ CREATE TRIGGER _xfer_r2 BEFORE INSERT ON _xfer_user | |
| 330 | - @ WHEN NOT config_is_reset(16) BEGIN | |
| 331 | - @ DELETE FROM _xfer_user; | |
| 332 | - @ SELECT config_reset(16); | |
| 333 | - @ END; | |
| 334 | - @ CREATE TEMP TRIGGER _xfer_r3 BEFORE INSERT ON shun | |
| 335 | - @ WHEN NOT config_is_reset(8) BEGIN | |
| 336 | - @ DELETE FROM shun; | |
| 337 | - @ SELECT config_reset(8); | |
| 338 | - @ END; | |
| 339 | - ; | |
| 340 | - sqlite3_create_function(g.db, "config_is_reset", 1, SQLITE_UTF8, 0, | |
| 341 | - config_is_reset_function, 0, 0); | |
| 342 | - sqlite3_create_function(g.db, "config_reset", 1, SQLITE_UTF8, 0, | |
| 343 | - config_reset_function, 0, 0); | |
| 344 | - configHasBeenReset = 0; | |
| 345 | - assert( strchr(zSQL2,'%')==0 ); | |
| 346 | - db_multi_exec(zSQL2 /*works-like:""*/); | |
| 347 | - } | |
| 348 | -} | |
| 349 | - | |
| 350 | -/* | |
| 351 | -** After receiving configuration data, call this routine to transfer | |
| 352 | -** the results into the main database. | |
| 353 | -*/ | |
| 354 | -void configure_finalize_receive(void){ | |
| 355 | - static const char zSQL[] = | |
| 356 | - @ DELETE FROM user; | |
| 357 | - @ INSERT INTO user SELECT * FROM _xfer_user; | |
| 358 | - @ DELETE FROM reportfmt; | |
| 359 | - @ INSERT INTO reportfmt SELECT * FROM _xfer_reportfmt; | |
| 360 | - @ DROP TABLE _xfer_user; | |
| 361 | - @ DROP TABLE _xfer_reportfmt; | |
| 362 | - ; | |
| 363 | - assert( strchr(zSQL,'%')==0 ); | |
| 364 | - db_multi_exec(zSQL /*works-like:""*/); | |
| 365 | -} | |
| 366 | - | |
| 367 | 279 | /* |
| 368 | 280 | ** Mask of modified configuration sets |
| 369 | 281 | */ |
| 370 | 282 | static int rebuildMask = 0; |
| 371 | 283 | |
| 372 | 284 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -274,98 +274,10 @@ | |
| 274 | ){ |
| 275 | int m = sqlite3_value_int(argv[0]); |
| 276 | configHasBeenReset |= m; |
| 277 | } |
| 278 | |
| 279 | /* |
| 280 | ** Create the temporary _xfer_reportfmt and _xfer_user tables that are |
| 281 | ** necessary in order to evaluate the SQL text generated by the |
| 282 | ** configure_render_special_name() routine. |
| 283 | ** |
| 284 | ** If replaceFlag is true, then the setup is such that the content in |
| 285 | ** the SQL text will completely replace the current repository configuration. |
| 286 | ** If replaceFlag is false, then the SQL text will be merged with the |
| 287 | ** existing configuration. When merging, existing values take priority |
| 288 | ** over SQL text values. |
| 289 | */ |
| 290 | void configure_prepare_to_receive(int replaceFlag){ |
| 291 | static const char zSQL1[] = |
| 292 | @ CREATE TEMP TABLE _xfer_reportfmt( |
| 293 | @ rn integer primary key, -- Report number |
| 294 | @ owner text, -- Owner of this report format (not used) |
| 295 | @ title text UNIQUE ON CONFLICT IGNORE, -- Title of this report |
| 296 | @ cols text, -- A color-key specification |
| 297 | @ sqlcode text -- An SQL SELECT statement for this report |
| 298 | @ ); |
| 299 | @ CREATE TEMP TABLE _xfer_user( |
| 300 | @ uid INTEGER PRIMARY KEY, -- User ID |
| 301 | @ login TEXT UNIQUE ON CONFLICT IGNORE, -- login name of the user |
| 302 | @ pw TEXT, -- password |
| 303 | @ cap TEXT, -- Capabilities of this user |
| 304 | @ cookie TEXT, -- WWW login cookie |
| 305 | @ ipaddr TEXT, -- IP address for which cookie is valid |
| 306 | @ cexpire DATETIME, -- Time when cookie expires |
| 307 | @ info TEXT, -- contact information |
| 308 | @ photo BLOB -- JPEG image of this user |
| 309 | @ ); |
| 310 | @ INSERT INTO _xfer_reportfmt |
| 311 | @ SELECT rn,owner,title,cols,sqlcode FROM reportfmt; |
| 312 | @ INSERT INTO _xfer_user |
| 313 | @ SELECT uid,login,pw,cap,cookie,ipaddr,cexpire,info,photo FROM user; |
| 314 | ; |
| 315 | assert( strchr(zSQL1,'%')==0 ); |
| 316 | db_multi_exec(zSQL1 /*works-like:""*/); |
| 317 | |
| 318 | /* When the replace flag is set, add triggers that run the first time |
| 319 | ** that new data is seen. The triggers run only once and delete all the |
| 320 | ** existing data. |
| 321 | */ |
| 322 | if( replaceFlag ){ |
| 323 | static const char zSQL2[] = |
| 324 | @ CREATE TRIGGER _xfer_r1 BEFORE INSERT ON _xfer_reportfmt |
| 325 | @ WHEN NOT config_is_reset(2) BEGIN |
| 326 | @ DELETE FROM _xfer_reportfmt; |
| 327 | @ SELECT config_reset(2); |
| 328 | @ END; |
| 329 | @ CREATE TRIGGER _xfer_r2 BEFORE INSERT ON _xfer_user |
| 330 | @ WHEN NOT config_is_reset(16) BEGIN |
| 331 | @ DELETE FROM _xfer_user; |
| 332 | @ SELECT config_reset(16); |
| 333 | @ END; |
| 334 | @ CREATE TEMP TRIGGER _xfer_r3 BEFORE INSERT ON shun |
| 335 | @ WHEN NOT config_is_reset(8) BEGIN |
| 336 | @ DELETE FROM shun; |
| 337 | @ SELECT config_reset(8); |
| 338 | @ END; |
| 339 | ; |
| 340 | sqlite3_create_function(g.db, "config_is_reset", 1, SQLITE_UTF8, 0, |
| 341 | config_is_reset_function, 0, 0); |
| 342 | sqlite3_create_function(g.db, "config_reset", 1, SQLITE_UTF8, 0, |
| 343 | config_reset_function, 0, 0); |
| 344 | configHasBeenReset = 0; |
| 345 | assert( strchr(zSQL2,'%')==0 ); |
| 346 | db_multi_exec(zSQL2 /*works-like:""*/); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | /* |
| 351 | ** After receiving configuration data, call this routine to transfer |
| 352 | ** the results into the main database. |
| 353 | */ |
| 354 | void configure_finalize_receive(void){ |
| 355 | static const char zSQL[] = |
| 356 | @ DELETE FROM user; |
| 357 | @ INSERT INTO user SELECT * FROM _xfer_user; |
| 358 | @ DELETE FROM reportfmt; |
| 359 | @ INSERT INTO reportfmt SELECT * FROM _xfer_reportfmt; |
| 360 | @ DROP TABLE _xfer_user; |
| 361 | @ DROP TABLE _xfer_reportfmt; |
| 362 | ; |
| 363 | assert( strchr(zSQL,'%')==0 ); |
| 364 | db_multi_exec(zSQL /*works-like:""*/); |
| 365 | } |
| 366 | |
| 367 | /* |
| 368 | ** Mask of modified configuration sets |
| 369 | */ |
| 370 | static int rebuildMask = 0; |
| 371 | |
| 372 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -274,98 +274,10 @@ | |
| 274 | ){ |
| 275 | int m = sqlite3_value_int(argv[0]); |
| 276 | configHasBeenReset |= m; |
| 277 | } |
| 278 | |
| 279 | /* |
| 280 | ** Mask of modified configuration sets |
| 281 | */ |
| 282 | static int rebuildMask = 0; |
| 283 | |
| 284 |
-8
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1135,11 +1135,10 @@ | ||
| 1135 | 1135 | Xfer xfer; |
| 1136 | 1136 | int deltaFlag = 0; |
| 1137 | 1137 | int isClone = 0; |
| 1138 | 1138 | int nGimme = 0; |
| 1139 | 1139 | int size; |
| 1140 | - int recvConfig = 0; | |
| 1141 | 1140 | char *zNow; |
| 1142 | 1141 | int rc; |
| 1143 | 1142 | const char *zScript = 0; |
| 1144 | 1143 | char *zUuidList = 0; |
| 1145 | 1144 | int nUuidList = 0; |
| @@ -1445,14 +1444,10 @@ | ||
| 1445 | 1444 | cgi_reset_content(); |
| 1446 | 1445 | @ error not\sauthorized\sto\spush\sconfiguration |
| 1447 | 1446 | nErr++; |
| 1448 | 1447 | break; |
| 1449 | 1448 | } |
| 1450 | - if( !recvConfig && zName[0]=='@' ){ | |
| 1451 | - configure_prepare_to_receive(0); | |
| 1452 | - recvConfig = 1; | |
| 1453 | - } | |
| 1454 | 1449 | configure_receive(zName, &content, CONFIGSET_ALL); |
| 1455 | 1450 | blob_reset(&content); |
| 1456 | 1451 | blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR); |
| 1457 | 1452 | }else |
| 1458 | 1453 | |
| @@ -1590,13 +1585,10 @@ | ||
| 1590 | 1585 | }else if( isPull ){ |
| 1591 | 1586 | create_cluster(); |
| 1592 | 1587 | send_unclustered(&xfer); |
| 1593 | 1588 | if( xfer.syncPrivate ) send_private(&xfer); |
| 1594 | 1589 | } |
| 1595 | - if( recvConfig ){ | |
| 1596 | - configure_finalize_receive(); | |
| 1597 | - } | |
| 1598 | 1590 | db_multi_exec("DROP TABLE onremote"); |
| 1599 | 1591 | manifest_crosslink_end(MC_PERMIT_HOOKS); |
| 1600 | 1592 | |
| 1601 | 1593 | /* Send the server timestamp last, in case prior processing happened |
| 1602 | 1594 | ** to use up a significant fraction of our time window. |
| 1603 | 1595 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1135,11 +1135,10 @@ | |
| 1135 | Xfer xfer; |
| 1136 | int deltaFlag = 0; |
| 1137 | int isClone = 0; |
| 1138 | int nGimme = 0; |
| 1139 | int size; |
| 1140 | int recvConfig = 0; |
| 1141 | char *zNow; |
| 1142 | int rc; |
| 1143 | const char *zScript = 0; |
| 1144 | char *zUuidList = 0; |
| 1145 | int nUuidList = 0; |
| @@ -1445,14 +1444,10 @@ | |
| 1445 | cgi_reset_content(); |
| 1446 | @ error not\sauthorized\sto\spush\sconfiguration |
| 1447 | nErr++; |
| 1448 | break; |
| 1449 | } |
| 1450 | if( !recvConfig && zName[0]=='@' ){ |
| 1451 | configure_prepare_to_receive(0); |
| 1452 | recvConfig = 1; |
| 1453 | } |
| 1454 | configure_receive(zName, &content, CONFIGSET_ALL); |
| 1455 | blob_reset(&content); |
| 1456 | blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR); |
| 1457 | }else |
| 1458 | |
| @@ -1590,13 +1585,10 @@ | |
| 1590 | }else if( isPull ){ |
| 1591 | create_cluster(); |
| 1592 | send_unclustered(&xfer); |
| 1593 | if( xfer.syncPrivate ) send_private(&xfer); |
| 1594 | } |
| 1595 | if( recvConfig ){ |
| 1596 | configure_finalize_receive(); |
| 1597 | } |
| 1598 | db_multi_exec("DROP TABLE onremote"); |
| 1599 | manifest_crosslink_end(MC_PERMIT_HOOKS); |
| 1600 | |
| 1601 | /* Send the server timestamp last, in case prior processing happened |
| 1602 | ** to use up a significant fraction of our time window. |
| 1603 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1135,11 +1135,10 @@ | |
| 1135 | Xfer xfer; |
| 1136 | int deltaFlag = 0; |
| 1137 | int isClone = 0; |
| 1138 | int nGimme = 0; |
| 1139 | int size; |
| 1140 | char *zNow; |
| 1141 | int rc; |
| 1142 | const char *zScript = 0; |
| 1143 | char *zUuidList = 0; |
| 1144 | int nUuidList = 0; |
| @@ -1445,14 +1444,10 @@ | |
| 1444 | cgi_reset_content(); |
| 1445 | @ error not\sauthorized\sto\spush\sconfiguration |
| 1446 | nErr++; |
| 1447 | break; |
| 1448 | } |
| 1449 | configure_receive(zName, &content, CONFIGSET_ALL); |
| 1450 | blob_reset(&content); |
| 1451 | blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR); |
| 1452 | }else |
| 1453 | |
| @@ -1590,13 +1585,10 @@ | |
| 1585 | }else if( isPull ){ |
| 1586 | create_cluster(); |
| 1587 | send_unclustered(&xfer); |
| 1588 | if( xfer.syncPrivate ) send_private(&xfer); |
| 1589 | } |
| 1590 | db_multi_exec("DROP TABLE onremote"); |
| 1591 | manifest_crosslink_end(MC_PERMIT_HOOKS); |
| 1592 | |
| 1593 | /* Send the server timestamp last, in case prior processing happened |
| 1594 | ** to use up a significant fraction of our time window. |
| 1595 |