Fossil SCM
All writes to the subscriber table to update the last contact time even if the request is not from the same origin.
Commit
db1626281796e9329d0d2e31c370ba36ddd54375e33237ce7fe43555090d5011
Parent
0aa3483fa89b622…
1 file changed
+4
+4
| --- src/alerts.c | ||
| +++ src/alerts.c | ||
| @@ -101,14 +101,16 @@ | ||
| 101 | 101 | ** Record the fact that user zUser has made contact with the repository. |
| 102 | 102 | ** This resets the subscription timeout on that user. |
| 103 | 103 | */ |
| 104 | 104 | void alert_user_contact(const char *zUser){ |
| 105 | 105 | if( db_table_has_column("repository","subscriber","lastContact") ){ |
| 106 | + db_unprotect(PROTECT_READONLY); | |
| 106 | 107 | db_multi_exec( |
| 107 | 108 | "UPDATE subscriber SET lastContact=now()/86400 WHERE suname=%Q", |
| 108 | 109 | zUser |
| 109 | 110 | ); |
| 111 | + db_protect_pop(); | |
| 110 | 112 | } |
| 111 | 113 | } |
| 112 | 114 | |
| 113 | 115 | /* |
| 114 | 116 | ** Make sure the table needed for email notification exist in the repository. |
| @@ -1874,14 +1876,16 @@ | ||
| 1874 | 1876 | db_exec_sql(blob_str(&update)); |
| 1875 | 1877 | ssub = 0; |
| 1876 | 1878 | } |
| 1877 | 1879 | blob_reset(&update); |
| 1878 | 1880 | }else if( keepAlive ){ |
| 1881 | + db_unprotect(PROTECT_READONLY); | |
| 1879 | 1882 | db_multi_exec( |
| 1880 | 1883 | "UPDATE subscriber SET lastContact=now()/86400" |
| 1881 | 1884 | " WHERE subscriberId=%d", sid |
| 1882 | 1885 | ); |
| 1886 | + db_protect_pop(); | |
| 1883 | 1887 | } |
| 1884 | 1888 | if( P("delete")!=0 && cgi_csrf_safe(1) ){ |
| 1885 | 1889 | if( !PB("dodelete") ){ |
| 1886 | 1890 | eErr = 9; |
| 1887 | 1891 | zErr = mprintf("Select this checkbox and press \"Unsubscribe\" again to" |
| 1888 | 1892 |
| --- src/alerts.c | |
| +++ src/alerts.c | |
| @@ -101,14 +101,16 @@ | |
| 101 | ** Record the fact that user zUser has made contact with the repository. |
| 102 | ** This resets the subscription timeout on that user. |
| 103 | */ |
| 104 | void alert_user_contact(const char *zUser){ |
| 105 | if( db_table_has_column("repository","subscriber","lastContact") ){ |
| 106 | db_multi_exec( |
| 107 | "UPDATE subscriber SET lastContact=now()/86400 WHERE suname=%Q", |
| 108 | zUser |
| 109 | ); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | /* |
| 114 | ** Make sure the table needed for email notification exist in the repository. |
| @@ -1874,14 +1876,16 @@ | |
| 1874 | db_exec_sql(blob_str(&update)); |
| 1875 | ssub = 0; |
| 1876 | } |
| 1877 | blob_reset(&update); |
| 1878 | }else if( keepAlive ){ |
| 1879 | db_multi_exec( |
| 1880 | "UPDATE subscriber SET lastContact=now()/86400" |
| 1881 | " WHERE subscriberId=%d", sid |
| 1882 | ); |
| 1883 | } |
| 1884 | if( P("delete")!=0 && cgi_csrf_safe(1) ){ |
| 1885 | if( !PB("dodelete") ){ |
| 1886 | eErr = 9; |
| 1887 | zErr = mprintf("Select this checkbox and press \"Unsubscribe\" again to" |
| 1888 |
| --- src/alerts.c | |
| +++ src/alerts.c | |
| @@ -101,14 +101,16 @@ | |
| 101 | ** Record the fact that user zUser has made contact with the repository. |
| 102 | ** This resets the subscription timeout on that user. |
| 103 | */ |
| 104 | void alert_user_contact(const char *zUser){ |
| 105 | if( db_table_has_column("repository","subscriber","lastContact") ){ |
| 106 | db_unprotect(PROTECT_READONLY); |
| 107 | db_multi_exec( |
| 108 | "UPDATE subscriber SET lastContact=now()/86400 WHERE suname=%Q", |
| 109 | zUser |
| 110 | ); |
| 111 | db_protect_pop(); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /* |
| 116 | ** Make sure the table needed for email notification exist in the repository. |
| @@ -1874,14 +1876,16 @@ | |
| 1876 | db_exec_sql(blob_str(&update)); |
| 1877 | ssub = 0; |
| 1878 | } |
| 1879 | blob_reset(&update); |
| 1880 | }else if( keepAlive ){ |
| 1881 | db_unprotect(PROTECT_READONLY); |
| 1882 | db_multi_exec( |
| 1883 | "UPDATE subscriber SET lastContact=now()/86400" |
| 1884 | " WHERE subscriberId=%d", sid |
| 1885 | ); |
| 1886 | db_protect_pop(); |
| 1887 | } |
| 1888 | if( P("delete")!=0 && cgi_csrf_safe(1) ){ |
| 1889 | if( !PB("dodelete") ){ |
| 1890 | eErr = 9; |
| 1891 | zErr = mprintf("Select this checkbox and press \"Unsubscribe\" again to" |
| 1892 |