Fossil SCM

Enable TH1 hooks for all web pages, known and unknown.

mistachkin 2014-06-09 20:07 th1Hooks
Commit f90f723010b6bd1c87fe140099ee59646111fa43
1 file changed +23 -7
+23 -7
--- src/main.c
+++ src/main.c
@@ -1543,21 +1543,37 @@
15431543
}
15441544
15451545
/* Locate the method specified by the path and execute the function
15461546
** that implements that method.
15471547
*/
1548
- if( name_search(g.zPath, aWebpage, count(aWebpage), &idx) &&
1549
- name_search("not_found", aWebpage, count(aWebpage), &idx) ){
1548
+ if( name_search(g.zPath, aWebpage, count(aWebpage), &idx) ){
15501549
#ifdef FOSSIL_ENABLE_JSON
15511550
if(g.json.isJsonMode){
15521551
json_err(FSL_JSON_E_RESOURCE_NOT_FOUND,NULL,0);
15531552
}else
15541553
#endif
15551554
{
1556
- cgi_set_status(404,"Not Found");
1557
- @ <h1>Not Found</h1>
1558
- @ <p>Page not found: %h(g.zPath)</p>
1555
+#ifdef FOSSIL_ENABLE_TH1_HOOKS
1556
+ int rc;
1557
+ if( !g.fNoThHook ){
1558
+ rc = Th_WebpageHook(g.zPath, 0);
1559
+ }else{
1560
+ rc = TH_OK;
1561
+ }
1562
+ if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){
1563
+ if( rc==TH_OK || rc==TH_RETURN ){
1564
+#endif
1565
+ cgi_set_status(404,"Not Found");
1566
+ @ <h1>Not Found</h1>
1567
+ @ <p>Page not found: %h(g.zPath)</p>
1568
+#ifdef FOSSIL_ENABLE_TH1_HOOKS
1569
+ }
1570
+ if( !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
1571
+ Th_WebpageNotify(g.zPath, 0);
1572
+ }
1573
+ }
1574
+#endif
15591575
}
15601576
}else if( aWebpage[idx].xFunc!=page_xfer && db_schema_is_outofdate() ){
15611577
#ifdef FOSSIL_ENABLE_JSON
15621578
if(g.json.isJsonMode){
15631579
json_err(FSL_JSON_E_DB_NEEDS_REBUILD,NULL,0);
@@ -1584,11 +1600,11 @@
15841600
**
15851601
** TH_CONTINUE: The xFunc() will be skipped, the TH1 notification will be
15861602
** executed.
15871603
*/
15881604
int rc;
1589
- if( !g.isHTTP && !g.fNoThHook ){
1605
+ if( !g.fNoThHook ){
15901606
rc = Th_WebpageHook(aWebpage[idx].zName, aWebpage[idx].cmdFlags);
15911607
}else{
15921608
rc = TH_OK;
15931609
}
15941610
if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){
@@ -1595,11 +1611,11 @@
15951611
if( rc==TH_OK || rc==TH_RETURN ){
15961612
#endif
15971613
aWebpage[idx].xFunc();
15981614
#ifdef FOSSIL_ENABLE_TH1_HOOKS
15991615
}
1600
- if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
1616
+ if( !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
16011617
Th_WebpageNotify(aWebpage[idx].zName, aWebpage[idx].cmdFlags);
16021618
}
16031619
}
16041620
#endif
16051621
}
16061622
--- src/main.c
+++ src/main.c
@@ -1543,21 +1543,37 @@
1543 }
1544
1545 /* Locate the method specified by the path and execute the function
1546 ** that implements that method.
1547 */
1548 if( name_search(g.zPath, aWebpage, count(aWebpage), &idx) &&
1549 name_search("not_found", aWebpage, count(aWebpage), &idx) ){
1550 #ifdef FOSSIL_ENABLE_JSON
1551 if(g.json.isJsonMode){
1552 json_err(FSL_JSON_E_RESOURCE_NOT_FOUND,NULL,0);
1553 }else
1554 #endif
1555 {
1556 cgi_set_status(404,"Not Found");
1557 @ <h1>Not Found</h1>
1558 @ <p>Page not found: %h(g.zPath)</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1559 }
1560 }else if( aWebpage[idx].xFunc!=page_xfer && db_schema_is_outofdate() ){
1561 #ifdef FOSSIL_ENABLE_JSON
1562 if(g.json.isJsonMode){
1563 json_err(FSL_JSON_E_DB_NEEDS_REBUILD,NULL,0);
@@ -1584,11 +1600,11 @@
1584 **
1585 ** TH_CONTINUE: The xFunc() will be skipped, the TH1 notification will be
1586 ** executed.
1587 */
1588 int rc;
1589 if( !g.isHTTP && !g.fNoThHook ){
1590 rc = Th_WebpageHook(aWebpage[idx].zName, aWebpage[idx].cmdFlags);
1591 }else{
1592 rc = TH_OK;
1593 }
1594 if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){
@@ -1595,11 +1611,11 @@
1595 if( rc==TH_OK || rc==TH_RETURN ){
1596 #endif
1597 aWebpage[idx].xFunc();
1598 #ifdef FOSSIL_ENABLE_TH1_HOOKS
1599 }
1600 if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
1601 Th_WebpageNotify(aWebpage[idx].zName, aWebpage[idx].cmdFlags);
1602 }
1603 }
1604 #endif
1605 }
1606
--- src/main.c
+++ src/main.c
@@ -1543,21 +1543,37 @@
1543 }
1544
1545 /* Locate the method specified by the path and execute the function
1546 ** that implements that method.
1547 */
1548 if( name_search(g.zPath, aWebpage, count(aWebpage), &idx) ){
 
1549 #ifdef FOSSIL_ENABLE_JSON
1550 if(g.json.isJsonMode){
1551 json_err(FSL_JSON_E_RESOURCE_NOT_FOUND,NULL,0);
1552 }else
1553 #endif
1554 {
1555 #ifdef FOSSIL_ENABLE_TH1_HOOKS
1556 int rc;
1557 if( !g.fNoThHook ){
1558 rc = Th_WebpageHook(g.zPath, 0);
1559 }else{
1560 rc = TH_OK;
1561 }
1562 if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){
1563 if( rc==TH_OK || rc==TH_RETURN ){
1564 #endif
1565 cgi_set_status(404,"Not Found");
1566 @ <h1>Not Found</h1>
1567 @ <p>Page not found: %h(g.zPath)</p>
1568 #ifdef FOSSIL_ENABLE_TH1_HOOKS
1569 }
1570 if( !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
1571 Th_WebpageNotify(g.zPath, 0);
1572 }
1573 }
1574 #endif
1575 }
1576 }else if( aWebpage[idx].xFunc!=page_xfer && db_schema_is_outofdate() ){
1577 #ifdef FOSSIL_ENABLE_JSON
1578 if(g.json.isJsonMode){
1579 json_err(FSL_JSON_E_DB_NEEDS_REBUILD,NULL,0);
@@ -1584,11 +1600,11 @@
1600 **
1601 ** TH_CONTINUE: The xFunc() will be skipped, the TH1 notification will be
1602 ** executed.
1603 */
1604 int rc;
1605 if( !g.fNoThHook ){
1606 rc = Th_WebpageHook(aWebpage[idx].zName, aWebpage[idx].cmdFlags);
1607 }else{
1608 rc = TH_OK;
1609 }
1610 if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){
@@ -1595,11 +1611,11 @@
1611 if( rc==TH_OK || rc==TH_RETURN ){
1612 #endif
1613 aWebpage[idx].xFunc();
1614 #ifdef FOSSIL_ENABLE_TH1_HOOKS
1615 }
1616 if( !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){
1617 Th_WebpageNotify(aWebpage[idx].zName, aWebpage[idx].cmdFlags);
1618 }
1619 }
1620 #endif
1621 }
1622

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button