Fossil SCM

All writes to the subscriber table to update the last contact time even if the request is not from the same origin.

drh 2022-12-29 21:09 trunk
Commit db1626281796e9329d0d2e31c370ba36ddd54375e33237ce7fe43555090d5011
1 file changed +4
--- src/alerts.c
+++ src/alerts.c
@@ -101,14 +101,16 @@
101101
** Record the fact that user zUser has made contact with the repository.
102102
** This resets the subscription timeout on that user.
103103
*/
104104
void alert_user_contact(const char *zUser){
105105
if( db_table_has_column("repository","subscriber","lastContact") ){
106
+ db_unprotect(PROTECT_READONLY);
106107
db_multi_exec(
107108
"UPDATE subscriber SET lastContact=now()/86400 WHERE suname=%Q",
108109
zUser
109110
);
111
+ db_protect_pop();
110112
}
111113
}
112114
113115
/*
114116
** Make sure the table needed for email notification exist in the repository.
@@ -1874,14 +1876,16 @@
18741876
db_exec_sql(blob_str(&update));
18751877
ssub = 0;
18761878
}
18771879
blob_reset(&update);
18781880
}else if( keepAlive ){
1881
+ db_unprotect(PROTECT_READONLY);
18791882
db_multi_exec(
18801883
"UPDATE subscriber SET lastContact=now()/86400"
18811884
" WHERE subscriberId=%d", sid
18821885
);
1886
+ db_protect_pop();
18831887
}
18841888
if( P("delete")!=0 && cgi_csrf_safe(1) ){
18851889
if( !PB("dodelete") ){
18861890
eErr = 9;
18871891
zErr = mprintf("Select this checkbox and press \"Unsubscribe\" again to"
18881892
--- 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

Keyboard Shortcuts

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