Fossil

Check-in [4ef59090]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Report on the email notification setup and status in the /stat page for administrators.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4ef590906d161d86df7ec1c29a22707802c0aa186631ca0d501a2dd9d5ff2b17
User & Date: drh 2018-06-25 20:56:15
Context
2018-06-25
20:59
On the /stat page, change the name of "Alerts:" to "Pending Alerts:". check-in: 6f34395c user: drh tags: trunk
20:56
Report on the email notification setup and status in the /stat page for administrators. check-in: 4ef59090 user: drh tags: trunk
20:26
Add the file_directory_size() utility function for measuring the number of objects in a directory. check-in: 94e846d2 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/email.c.

1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
void subscriber_list_page(void){
  Blob sql;
  Stmt q;
  double rNow;
  if( email_webpages_disabled() ) return;
  login_check_credentials();
  if( !g.perm.Admin ){
    fossil_redirect_home();
    return;
  }
  email_submenu_common();
  style_header("Subscriber List");
  blob_init(&sql, 0, 0);
  blob_append_sql(&sql,
    "SELECT hex(subscriberCode),"          /* 0 */







|







1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
void subscriber_list_page(void){
  Blob sql;
  Stmt q;
  double rNow;
  if( email_webpages_disabled() ) return;
  login_check_credentials();
  if( !g.perm.Admin ){
    login_needed(0);
    return;
  }
  email_submenu_common();
  style_header("Subscriber List");
  blob_init(&sql, 0, 0);
  blob_append_sql(&sql,
    "SELECT hex(subscriberCode),"          /* 0 */

Changes to src/stat.c.

196
197
198
199
200
201
202


















































203
204
205
206
207
208
209
  @ <tr><th>Database&nbsp;Stats:</th><td>
  @ %,d(db_int(0, "PRAGMA repository.page_count")) pages,
  @ %d(db_int(0, "PRAGMA repository.page_size")) bytes/page,
  @ %,d(db_int(0, "PRAGMA repository.freelist_count")) free pages,
  @ %s(db_text(0, "PRAGMA repository.encoding")),
  @ %s(db_text(0, "PRAGMA repository.journal_mode")) mode
  @ </td></tr>



















































  @ </table>
  style_footer();
}

/*
** COMMAND: dbstat*







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
  @ <tr><th>Database&nbsp;Stats:</th><td>
  @ %,d(db_int(0, "PRAGMA repository.page_count")) pages,
  @ %d(db_int(0, "PRAGMA repository.page_size")) bytes/page,
  @ %,d(db_int(0, "PRAGMA repository.freelist_count")) free pages,
  @ %s(db_text(0, "PRAGMA repository.encoding")),
  @ %s(db_text(0, "PRAGMA repository.journal_mode")) mode
  @ </td></tr>
  if( g.perm.Admin && email_enabled() ){
    const char *zDest = db_get("email-send-method",0);
    int nSub, nASub, nPend, nDPend;
    const char *zDir, *zDb, *zCmd;
    @ <tr><th>Outgoing&nbsp;Email:</th><td>
    if( fossil_strcmp(zDest,"pipe")==0
     && (zCmd = db_get("email-send-command",0))!=0
    ){
      @ Piped to command "%h(zCmd)"
    }else
    if( fossil_strcmp(zDest,"db")==0
     && (zDb = db_get("email-send-db",0))!=0
    ){
      sqlite3 *db;
      sqlite3_stmt *pStmt;
      int rc;
      @ Queued to database "%h(zDb)"
      rc = sqlite3_open(zDb, &db);
      if( rc==SQLITE_OK ){
        rc = sqlite3_prepare_v2(db, "SELECT count(*) FROM email",-1,&pStmt,0);
        if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
          @ (%,d(sqlite3_column_int(pStmt,0)) messages,
          @ %,d(file_size(zDb,ExtFILE)) bytes)
        }
        sqlite3_finalize(pStmt);
      }
      sqlite3_close(db);
    }else
    if( fossil_strcmp(zDest,"dir")==0
     && (zDir = db_get("email-send-dir",0))!=0
    ){
      @ Written to files in "%h(zDir)"
      @ (%,d(file_directory_size(zDir,0,1)) messages)
    }else{
      @ Off
    }
    @ </td></tr>
    nPend = db_int(0,"SELECT count(*) FROM pending_alert WHERE NOT sentSep");
    nDPend = db_int(0,"SELECT count(*) FROM pending_alert"
                      " WHERE NOT sentDigest");
    @ <tr><th>Alerts:</th><td>
    @ %,d(nPend) normal, %,d(nDPend) digest
    @ </td></tr>
    @ <tr><th>Subscribers:</th><td>
    nSub = db_int(0, "SELECT count(*) FROM subscriber");
    nASub = db_int(0, "SELECT count(*) FROM subscriber WHERE sverified"
                     " AND NOT sdonotcall AND length(ssub)>1");
    @ %,d(nASub) active, %,d(nSub) total
    @ </td></tr>
  }

  @ </table>
  style_footer();
}

/*
** COMMAND: dbstat*