Fossil SCM

The email_auto_exec property is removed. The routine that sends alert emails is renamed to email_backoffice() and it is configured to always auto-run.

drh 2018-07-19 17:22 trunk
Commit ada7ecde5bf91e18fdaee1367f0aa25cf48830dd06ecfcbedc9783977728d737
2 files changed +1 -1 +8 -18
--- src/backoffice.c
+++ src/backoffice.c
@@ -249,11 +249,11 @@
249249
/*
250250
** This routine runs to do the backoffice processing. When adding new
251251
** backoffice processing tasks, add them here.
252252
*/
253253
void backoffice_work(void){
254
- email_auto_exec(0);
254
+ email_backoffice(0);
255255
}
256256
257257
/*
258258
** COMMAND: test-backoffice
259259
**
260260
--- src/backoffice.c
+++ src/backoffice.c
@@ -249,11 +249,11 @@
249 /*
250 ** This routine runs to do the backoffice processing. When adding new
251 ** backoffice processing tasks, add them here.
252 */
253 void backoffice_work(void){
254 email_auto_exec(0);
255 }
256
257 /*
258 ** COMMAND: test-backoffice
259 **
260
--- src/backoffice.c
+++ src/backoffice.c
@@ -249,11 +249,11 @@
249 /*
250 ** This routine runs to do the backoffice processing. When adding new
251 ** backoffice processing tasks, add them here.
252 */
253 void backoffice_work(void){
254 email_backoffice(0);
255 }
256
257 /*
258 ** COMMAND: test-backoffice
259 **
260
+8 -18
--- src/email.c
+++ src/email.c
@@ -245,19 +245,10 @@
245245
@ Subject: line of email alerts. Traditionally this name is
246246
@ included in square brackets. Examples: "[fossil-src]", "[sqlite-src]".
247247
@ (Property: "email-subname")</p>
248248
@ <hr>
249249
250
- onoff_attribute("Automatic Email Exec", "email-autoexec",
251
- "eauto", 0, 0);
252
- @ <p>If enabled, then email notifications are automatically
253
- @ dispatched after some webpages are accessed. This eliminates the
254
- @ need to have a cron job running to invoke "fossil email exec"
255
- @ periodically.
256
- @ (Property: "email-autoexec")</p>
257
- @ <hr>
258
-
259250
multiple_choice_attribute("Email Send Method", "email-send-method", "esm",
260251
"off", count(azSendMethods)/2, azSendMethods);
261252
@ <p>How to send email. Requires auxiliary information from the fields
262253
@ that follow. Hint: Use the <a href="%R/announce">/announce</a> page
263254
@ to send test message to debug this setting.
@@ -1945,11 +1936,11 @@
19451936
}
19461937
19471938
/*
19481939
** COMMAND: test-add-alerts
19491940
**
1950
-** Usage: %fossil test-add-alerts [--autoexec] EVENTID ...
1941
+** Usage: %fossil test-add-alerts [--backoffice] EVENTID ...
19511942
**
19521943
** Add one or more events to the pending_alert queue. Use this
19531944
** command during testing to force email notifications for specific
19541945
** events.
19551946
**
@@ -1956,27 +1947,27 @@
19561947
** EVENTIDs are text. The first character is 'c', 'w', or 't'
19571948
** for check-in, wiki, or ticket. The remaining text is a
19581949
** integer that references the EVENT.OBJID value for the event.
19591950
** Run /timeline?showid to see these OBJID values.
19601951
**
1961
-** If the --autoexec option is included, then email_auto_exec() is run
1952
+** If the --backoffice option is included, then email_backoffice() is run
19621953
** after all alerts have been added. This will cause the alerts to
19631954
** be sent out with the SENDALERT_TRACE option.
19641955
*/
19651956
void test_add_alert_cmd(void){
19661957
int i;
1967
- int doAuto = find_option("autoexec",0,0)!=0;
1958
+ int doAuto = find_option("backoffice",0,0)!=0;
19681959
db_find_and_open_repository(0, 0);
19691960
verify_all_options();
19701961
db_begin_write();
19711962
email_schema(0);
19721963
for(i=2; i<g.argc; i++){
19731964
db_multi_exec("REPLACE INTO pending_alert(eventId) VALUES(%Q)", g.argv[i]);
19741965
}
19751966
db_end_transaction(0);
19761967
if( doAuto ){
1977
- email_auto_exec(SENDALERT_TRACE);
1968
+ email_backoffice(SENDALERT_TRACE);
19781969
}
19791970
}
19801971
19811972
#if INTERFACE
19821973
/*
@@ -2092,24 +2083,23 @@
20922083
if( g.fSqlTrace ) fossil_trace("-- END email_send_alerts(%u)\n", flags);
20932084
db_end_transaction(0);
20942085
}
20952086
20962087
/*
2097
-** Check to see if any email notifications need to occur, and then
2088
+** Do backoffice processing for email notifications. In other words,
2089
+** check to see if any email notifications need to occur, and then
20982090
** do them.
20992091
**
2100
-** This routine is called after certain webpages have been run and
2101
-** have already responded.
2092
+** This routine is intended to run in the background, after webpages.
21022093
**
21032094
** The mFlags option is zero or more of the SENDALERT_* flags. Normally
21042095
** this flag is zero, but the test-set-alert command sets it to
21052096
** SENDALERT_TRACE.
21062097
*/
2107
-void email_auto_exec(u32 mFlags){
2098
+void email_backoffice(u32 mFlags){
21082099
int iJulianDay;
21092100
if( !email_tables_exist() ) return;
2110
- if( !db_get_boolean("email-autoexec",0) ) return;
21112101
email_send_alerts(mFlags);
21122102
iJulianDay = db_int(0, "SELECT julianday('now')");
21132103
if( iJulianDay>db_get_int("email-last-digest",0) ){
21142104
db_set_int("email-last-digest",iJulianDay,0);
21152105
email_send_alerts(SENDALERT_DIGEST|mFlags);
21162106
--- src/email.c
+++ src/email.c
@@ -245,19 +245,10 @@
245 @ Subject: line of email alerts. Traditionally this name is
246 @ included in square brackets. Examples: "[fossil-src]", "[sqlite-src]".
247 @ (Property: "email-subname")</p>
248 @ <hr>
249
250 onoff_attribute("Automatic Email Exec", "email-autoexec",
251 "eauto", 0, 0);
252 @ <p>If enabled, then email notifications are automatically
253 @ dispatched after some webpages are accessed. This eliminates the
254 @ need to have a cron job running to invoke "fossil email exec"
255 @ periodically.
256 @ (Property: "email-autoexec")</p>
257 @ <hr>
258
259 multiple_choice_attribute("Email Send Method", "email-send-method", "esm",
260 "off", count(azSendMethods)/2, azSendMethods);
261 @ <p>How to send email. Requires auxiliary information from the fields
262 @ that follow. Hint: Use the <a href="%R/announce">/announce</a> page
263 @ to send test message to debug this setting.
@@ -1945,11 +1936,11 @@
1945 }
1946
1947 /*
1948 ** COMMAND: test-add-alerts
1949 **
1950 ** Usage: %fossil test-add-alerts [--autoexec] EVENTID ...
1951 **
1952 ** Add one or more events to the pending_alert queue. Use this
1953 ** command during testing to force email notifications for specific
1954 ** events.
1955 **
@@ -1956,27 +1947,27 @@
1956 ** EVENTIDs are text. The first character is 'c', 'w', or 't'
1957 ** for check-in, wiki, or ticket. The remaining text is a
1958 ** integer that references the EVENT.OBJID value for the event.
1959 ** Run /timeline?showid to see these OBJID values.
1960 **
1961 ** If the --autoexec option is included, then email_auto_exec() is run
1962 ** after all alerts have been added. This will cause the alerts to
1963 ** be sent out with the SENDALERT_TRACE option.
1964 */
1965 void test_add_alert_cmd(void){
1966 int i;
1967 int doAuto = find_option("autoexec",0,0)!=0;
1968 db_find_and_open_repository(0, 0);
1969 verify_all_options();
1970 db_begin_write();
1971 email_schema(0);
1972 for(i=2; i<g.argc; i++){
1973 db_multi_exec("REPLACE INTO pending_alert(eventId) VALUES(%Q)", g.argv[i]);
1974 }
1975 db_end_transaction(0);
1976 if( doAuto ){
1977 email_auto_exec(SENDALERT_TRACE);
1978 }
1979 }
1980
1981 #if INTERFACE
1982 /*
@@ -2092,24 +2083,23 @@
2092 if( g.fSqlTrace ) fossil_trace("-- END email_send_alerts(%u)\n", flags);
2093 db_end_transaction(0);
2094 }
2095
2096 /*
2097 ** Check to see if any email notifications need to occur, and then
 
2098 ** do them.
2099 **
2100 ** This routine is called after certain webpages have been run and
2101 ** have already responded.
2102 **
2103 ** The mFlags option is zero or more of the SENDALERT_* flags. Normally
2104 ** this flag is zero, but the test-set-alert command sets it to
2105 ** SENDALERT_TRACE.
2106 */
2107 void email_auto_exec(u32 mFlags){
2108 int iJulianDay;
2109 if( !email_tables_exist() ) return;
2110 if( !db_get_boolean("email-autoexec",0) ) return;
2111 email_send_alerts(mFlags);
2112 iJulianDay = db_int(0, "SELECT julianday('now')");
2113 if( iJulianDay>db_get_int("email-last-digest",0) ){
2114 db_set_int("email-last-digest",iJulianDay,0);
2115 email_send_alerts(SENDALERT_DIGEST|mFlags);
2116
--- src/email.c
+++ src/email.c
@@ -245,19 +245,10 @@
245 @ Subject: line of email alerts. Traditionally this name is
246 @ included in square brackets. Examples: "[fossil-src]", "[sqlite-src]".
247 @ (Property: "email-subname")</p>
248 @ <hr>
249
 
 
 
 
 
 
 
 
 
250 multiple_choice_attribute("Email Send Method", "email-send-method", "esm",
251 "off", count(azSendMethods)/2, azSendMethods);
252 @ <p>How to send email. Requires auxiliary information from the fields
253 @ that follow. Hint: Use the <a href="%R/announce">/announce</a> page
254 @ to send test message to debug this setting.
@@ -1945,11 +1936,11 @@
1936 }
1937
1938 /*
1939 ** COMMAND: test-add-alerts
1940 **
1941 ** Usage: %fossil test-add-alerts [--backoffice] EVENTID ...
1942 **
1943 ** Add one or more events to the pending_alert queue. Use this
1944 ** command during testing to force email notifications for specific
1945 ** events.
1946 **
@@ -1956,27 +1947,27 @@
1947 ** EVENTIDs are text. The first character is 'c', 'w', or 't'
1948 ** for check-in, wiki, or ticket. The remaining text is a
1949 ** integer that references the EVENT.OBJID value for the event.
1950 ** Run /timeline?showid to see these OBJID values.
1951 **
1952 ** If the --backoffice option is included, then email_backoffice() is run
1953 ** after all alerts have been added. This will cause the alerts to
1954 ** be sent out with the SENDALERT_TRACE option.
1955 */
1956 void test_add_alert_cmd(void){
1957 int i;
1958 int doAuto = find_option("backoffice",0,0)!=0;
1959 db_find_and_open_repository(0, 0);
1960 verify_all_options();
1961 db_begin_write();
1962 email_schema(0);
1963 for(i=2; i<g.argc; i++){
1964 db_multi_exec("REPLACE INTO pending_alert(eventId) VALUES(%Q)", g.argv[i]);
1965 }
1966 db_end_transaction(0);
1967 if( doAuto ){
1968 email_backoffice(SENDALERT_TRACE);
1969 }
1970 }
1971
1972 #if INTERFACE
1973 /*
@@ -2092,24 +2083,23 @@
2083 if( g.fSqlTrace ) fossil_trace("-- END email_send_alerts(%u)\n", flags);
2084 db_end_transaction(0);
2085 }
2086
2087 /*
2088 ** Do backoffice processing for email notifications. In other words,
2089 ** check to see if any email notifications need to occur, and then
2090 ** do them.
2091 **
2092 ** This routine is intended to run in the background, after webpages.
 
2093 **
2094 ** The mFlags option is zero or more of the SENDALERT_* flags. Normally
2095 ** this flag is zero, but the test-set-alert command sets it to
2096 ** SENDALERT_TRACE.
2097 */
2098 void email_backoffice(u32 mFlags){
2099 int iJulianDay;
2100 if( !email_tables_exist() ) return;
 
2101 email_send_alerts(mFlags);
2102 iJulianDay = db_int(0, "SELECT julianday('now')");
2103 if( iJulianDay>db_get_int("email-last-digest",0) ){
2104 db_set_int("email-last-digest",iJulianDay,0);
2105 email_send_alerts(SENDALERT_DIGEST|mFlags);
2106

Keyboard Shortcuts

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