Fossil SCM
Add the /test-backoffice-lease web page.
Commit
4a544e5dcb236b7d3fc391ce594339f567f39000b753fe73e822bc06603ca017
Parent
15f85cfdaaf9918…
1 file changed
+61
+61
| --- src/backoffice.c | ||
| +++ src/backoffice.c | ||
| @@ -162,10 +162,18 @@ | ||
| 162 | 162 | ** longer than needed. |
| 163 | 163 | */ |
| 164 | 164 | void backoffice_no_delay(void){ |
| 165 | 165 | backofficeNoDelay = 1; |
| 166 | 166 | } |
| 167 | + | |
| 168 | +/* | |
| 169 | +** Signal that the backoffice should not be run at the conclusion of | |
| 170 | +** the current session. | |
| 171 | +*/ | |
| 172 | +void backoffice_do_not_run(void){ | |
| 173 | + backofficeDb = "x"; | |
| 174 | +} | |
| 167 | 175 | |
| 168 | 176 | /* |
| 169 | 177 | ** Sleeps for the specified number of milliseconds -OR- until interrupted |
| 170 | 178 | ** by another thread (if supported by the underlying platform). Non-zero |
| 171 | 179 | ** will be returned if the sleep was interrupted. |
| @@ -432,10 +440,63 @@ | ||
| 432 | 440 | }else{ |
| 433 | 441 | fossil_print("\n"); |
| 434 | 442 | } |
| 435 | 443 | } |
| 436 | 444 | |
| 445 | + | |
| 446 | +/* | |
| 447 | +** WEBPAGE: test-backoffice-lease | |
| 448 | +** | |
| 449 | +** Print out information about the backoffice "lease" entry in the | |
| 450 | +** config table that controls whether or not backoffice should run. | |
| 451 | +*/ | |
| 452 | +void test_backoffice_lease_page(void){ | |
| 453 | + sqlite3_int64 tmNow = time(0); | |
| 454 | + Lease x; | |
| 455 | + const char *zLease; | |
| 456 | + login_check_credentials(); | |
| 457 | + if( !g.perm.Setup ){ | |
| 458 | + login_needed(0); | |
| 459 | + return; | |
| 460 | + } | |
| 461 | + style_header("Backoffice Lease"); | |
| 462 | + backoffice_do_not_run(); | |
| 463 | + @ <table class='label-value'> | |
| 464 | + zLease = db_get("backoffice",""); | |
| 465 | + @ <tr><th>Now:</th><td>%lld(tmNow)</td></tr> | |
| 466 | + @ <tr><th>Lease:</th><td colspan="3">"%h(zLease)"</td></tr> | |
| 467 | + backofficeReadLease(&x); | |
| 468 | + @ <tr><th>idCurrent:</th><td>%lld(x.idCurrent)</td><td> </td><td>\ | |
| 469 | + if( backofficeProcessExists(x.idCurrent) ){ | |
| 470 | + @ (exists) \ | |
| 471 | + } | |
| 472 | + if( backofficeProcessDone(x.idCurrent) ){ | |
| 473 | + @ (done) \ | |
| 474 | + } | |
| 475 | + @ </td></tr> | |
| 476 | + @ <tr><th>tmCurrent:</th><td>%lld(x.tmCurrent)</td><td></td><td>\ | |
| 477 | + if( x.tmCurrent>0 ){ | |
| 478 | + @ (now%+lld(x.tmCurrent-tmNow)) \ | |
| 479 | + } | |
| 480 | + @ </td></tr> | |
| 481 | + @ <tr><th>idNext:</th><td>%lld(x.idNext)</td><td> </td><td>\ | |
| 482 | + if( backofficeProcessExists(x.idNext) ){ | |
| 483 | + @ (exists) \ | |
| 484 | + } | |
| 485 | + if( backofficeProcessDone(x.idNext) ){ | |
| 486 | + @ (done) \ | |
| 487 | + } | |
| 488 | + @ </td></tr> | |
| 489 | + @ <tr><th>tmNext:</th><td>%lld(x.tmNext)</td><td></td><td>\ | |
| 490 | + if( x.tmNext>0 ){ | |
| 491 | + @ (now%+lld(x.tmNext-tmNow)) \ | |
| 492 | + } | |
| 493 | + @ </td></tr> | |
| 494 | + @ </table> | |
| 495 | + style_footer(); | |
| 496 | +} | |
| 497 | + | |
| 437 | 498 | /* |
| 438 | 499 | ** If backoffice processing is needed set the backofficeDb variable to the |
| 439 | 500 | ** name of the database file. If no backoffice processing is needed, |
| 440 | 501 | ** this routine makes no changes to state. |
| 441 | 502 | */ |
| 442 | 503 |
| --- src/backoffice.c | |
| +++ src/backoffice.c | |
| @@ -162,10 +162,18 @@ | |
| 162 | ** longer than needed. |
| 163 | */ |
| 164 | void backoffice_no_delay(void){ |
| 165 | backofficeNoDelay = 1; |
| 166 | } |
| 167 | |
| 168 | /* |
| 169 | ** Sleeps for the specified number of milliseconds -OR- until interrupted |
| 170 | ** by another thread (if supported by the underlying platform). Non-zero |
| 171 | ** will be returned if the sleep was interrupted. |
| @@ -432,10 +440,63 @@ | |
| 432 | }else{ |
| 433 | fossil_print("\n"); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | /* |
| 438 | ** If backoffice processing is needed set the backofficeDb variable to the |
| 439 | ** name of the database file. If no backoffice processing is needed, |
| 440 | ** this routine makes no changes to state. |
| 441 | */ |
| 442 |
| --- src/backoffice.c | |
| +++ src/backoffice.c | |
| @@ -162,10 +162,18 @@ | |
| 162 | ** longer than needed. |
| 163 | */ |
| 164 | void backoffice_no_delay(void){ |
| 165 | backofficeNoDelay = 1; |
| 166 | } |
| 167 | |
| 168 | /* |
| 169 | ** Signal that the backoffice should not be run at the conclusion of |
| 170 | ** the current session. |
| 171 | */ |
| 172 | void backoffice_do_not_run(void){ |
| 173 | backofficeDb = "x"; |
| 174 | } |
| 175 | |
| 176 | /* |
| 177 | ** Sleeps for the specified number of milliseconds -OR- until interrupted |
| 178 | ** by another thread (if supported by the underlying platform). Non-zero |
| 179 | ** will be returned if the sleep was interrupted. |
| @@ -432,10 +440,63 @@ | |
| 440 | }else{ |
| 441 | fossil_print("\n"); |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | |
| 446 | /* |
| 447 | ** WEBPAGE: test-backoffice-lease |
| 448 | ** |
| 449 | ** Print out information about the backoffice "lease" entry in the |
| 450 | ** config table that controls whether or not backoffice should run. |
| 451 | */ |
| 452 | void test_backoffice_lease_page(void){ |
| 453 | sqlite3_int64 tmNow = time(0); |
| 454 | Lease x; |
| 455 | const char *zLease; |
| 456 | login_check_credentials(); |
| 457 | if( !g.perm.Setup ){ |
| 458 | login_needed(0); |
| 459 | return; |
| 460 | } |
| 461 | style_header("Backoffice Lease"); |
| 462 | backoffice_do_not_run(); |
| 463 | @ <table class='label-value'> |
| 464 | zLease = db_get("backoffice",""); |
| 465 | @ <tr><th>Now:</th><td>%lld(tmNow)</td></tr> |
| 466 | @ <tr><th>Lease:</th><td colspan="3">"%h(zLease)"</td></tr> |
| 467 | backofficeReadLease(&x); |
| 468 | @ <tr><th>idCurrent:</th><td>%lld(x.idCurrent)</td><td> </td><td>\ |
| 469 | if( backofficeProcessExists(x.idCurrent) ){ |
| 470 | @ (exists) \ |
| 471 | } |
| 472 | if( backofficeProcessDone(x.idCurrent) ){ |
| 473 | @ (done) \ |
| 474 | } |
| 475 | @ </td></tr> |
| 476 | @ <tr><th>tmCurrent:</th><td>%lld(x.tmCurrent)</td><td></td><td>\ |
| 477 | if( x.tmCurrent>0 ){ |
| 478 | @ (now%+lld(x.tmCurrent-tmNow)) \ |
| 479 | } |
| 480 | @ </td></tr> |
| 481 | @ <tr><th>idNext:</th><td>%lld(x.idNext)</td><td> </td><td>\ |
| 482 | if( backofficeProcessExists(x.idNext) ){ |
| 483 | @ (exists) \ |
| 484 | } |
| 485 | if( backofficeProcessDone(x.idNext) ){ |
| 486 | @ (done) \ |
| 487 | } |
| 488 | @ </td></tr> |
| 489 | @ <tr><th>tmNext:</th><td>%lld(x.tmNext)</td><td></td><td>\ |
| 490 | if( x.tmNext>0 ){ |
| 491 | @ (now%+lld(x.tmNext-tmNow)) \ |
| 492 | } |
| 493 | @ </td></tr> |
| 494 | @ </table> |
| 495 | style_footer(); |
| 496 | } |
| 497 | |
| 498 | /* |
| 499 | ** If backoffice processing is needed set the backofficeDb variable to the |
| 500 | ** name of the database file. If no backoffice processing is needed, |
| 501 | ** this routine makes no changes to state. |
| 502 | */ |
| 503 |