| | @@ -1494,18 +1494,25 @@ |
| 1494 | 1494 | #endif /* LOCAL_INTERFACE */ |
| 1495 | 1495 | |
| 1496 | 1496 | /* |
| 1497 | 1497 | ** Finish up a sequence of manifest_crosslink calls. |
| 1498 | 1498 | */ |
| 1499 | | -void manifest_crosslink_end(void){ |
| 1499 | +int manifest_crosslink_end(int flags){ |
| 1500 | 1500 | Stmt q, u; |
| 1501 | 1501 | int i; |
| 1502 | + int rc = TH_ERROR; |
| 1502 | 1503 | assert( manifest_crosslink_busy==1 ); |
| 1504 | + if( flags&MC_PERMIT_HOOKS ){ |
| 1505 | + rc = xfer_run_common_script(); |
| 1506 | + } |
| 1503 | 1507 | db_prepare(&q, "SELECT uuid FROM pending_tkt"); |
| 1504 | 1508 | while( db_step(&q)==SQLITE_ROW ){ |
| 1505 | 1509 | const char *zUuid = db_column_text(&q, 0); |
| 1506 | 1510 | ticket_rebuild_entry(zUuid); |
| 1511 | + if( rc==TH_OK ){ |
| 1512 | + rc = xfer_run_script(xfer_ticket_code(), zUuid); |
| 1513 | + } |
| 1507 | 1514 | } |
| 1508 | 1515 | db_finalize(&q); |
| 1509 | 1516 | db_multi_exec("DROP TABLE pending_tkt"); |
| 1510 | 1517 | |
| 1511 | 1518 | /* If multiple check-ins happen close together in time, adjust their |
| | @@ -1536,10 +1543,11 @@ |
| 1536 | 1543 | "DROP TABLE time_fudge;" |
| 1537 | 1544 | ); |
| 1538 | 1545 | |
| 1539 | 1546 | db_end_transaction(0); |
| 1540 | 1547 | manifest_crosslink_busy = 0; |
| 1548 | + return rc; |
| 1541 | 1549 | } |
| 1542 | 1550 | |
| 1543 | 1551 | /* |
| 1544 | 1552 | ** Make an entry in the event table for a ticket change artifact. |
| 1545 | 1553 | */ |
| | @@ -1883,12 +1891,10 @@ |
| 1883 | 1891 | } |
| 1884 | 1892 | } |
| 1885 | 1893 | if( p->type==CFTYPE_TICKET ){ |
| 1886 | 1894 | char *zTag; |
| 1887 | 1895 | |
| 1888 | | - zScript = xfer_ticket_code(); |
| 1889 | | - zUuid = p->zTicketUuid; |
| 1890 | 1896 | assert( manifest_crosslink_busy==1 ); |
| 1891 | 1897 | zTag = mprintf("tkt-%s", p->zTicketUuid); |
| 1892 | 1898 | tag_insert(zTag, 1, 0, rid, p->rDate, rid); |
| 1893 | 1899 | free(zTag); |
| 1894 | 1900 | db_multi_exec("INSERT OR IGNORE INTO pending_tkt VALUES(%Q)", |
| 1895 | 1901 | |