Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Added admin_log(), for (informally) recording changes made by admins. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | admin-logging |
| Files: | files | file ages | folders |
| SHA1: |
ee666c46fb7d1f3e3f2837c43f1d10c9 |
| User & Date: | stephan 2014-11-27 16:59:49.387 |
Context
|
2014-11-28
| ||
| 15:05 | Change the name of the admin-log table to "admin_log". Only write to it if the "admin-log" setting is enabled (off by default). Make sure the admin_log table is created in the repository and not in the local or config databases. check-in: 5e0514a607 user: drh tags: admin-logging | |
|
2014-11-27
| ||
| 16:59 | Added admin_log(), for (informally) recording changes made by admins. check-in: ee666c46fb user: stephan tags: admin-logging | |
|
2014-11-26
| ||
| 19:15 | Revert the built-in SQLite to version 3.8.7.2 until a btree problem in 3.8.8 is fixed. check-in: 194c3ff362 user: drh tags: trunk | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
2674 2675 2676 2677 2678 2679 2680 |
}else{
db_multi_exec("%s", blob_sql_text(&allSql));
}
blob_reset(&allSql);
db_close(1);
}
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 |
}else{
db_multi_exec("%s", blob_sql_text(&allSql));
}
blob_reset(&allSql);
db_close(1);
}
}
void admin_log(const char *zFormat, ...){
static int once = 0;
char * zUserName = g.userUid>0
? db_text(0, "select login from user where uid=%d", g.userUid)
: 0;
Blob what = empty_blob;
va_list ap;
int rc;
if(!once){
once = 1;
rc = db_multi_exec("CREATE TABLE IF NOT EXISTS aevent("
"id INTEGER PRIMARY KEY, "
"time FLOAT /* Julian time */, "
"page TEXT /* path of page */,"
"who TEXT /* user name */, "
"what TEXT /* descr. of event. */ "
")");
fossil_trace("created aevent. rc=%d\n", rc);
}
va_start(ap,zFormat);
blob_vappendf( &what, zFormat, ap );
va_end(ap);
fossil_trace("what==%B rc=%d\n", &what, rc);
db_multi_exec("INSERT INTO aevent(id,time,page,who,what) VALUES("
"NULL, cast(strftime('%%J') AS FLOAT), %Q, %Q, %B"
")", g.zPath, zUserName, &what);
fossil_free(zUserName);
blob_reset(&what);
}
|
Changes to src/setup.c.
| ︙ | ︙ | |||
378 379 380 381 382 383 384 |
style_footer();
return;
}
login_verify_csrf_secret();
db_multi_exec(
"REPLACE INTO user(uid,login,info,pw,cap,mtime) "
"VALUES(nullif(%d,0),%Q,%Q,%Q,%Q,now())",
| | > | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
style_footer();
return;
}
login_verify_csrf_secret();
db_multi_exec(
"REPLACE INTO user(uid,login,info,pw,cap,mtime) "
"VALUES(nullif(%d,0),%Q,%Q,%Q,%Q,now())",
uid, zLogin, P("info"), zPw, zCap
);
admin_log( "Updated user %Q with capapbilities [%q].", zLogin, zCap );
if( atoi(PD("all","0"))>0 ){
Blob sql;
char *zErr = 0;
blob_zero(&sql);
if( zOldLogin==0 ){
blob_appendf(&sql,
"INSERT INTO user(login)"
|
| ︙ | ︙ | |||
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
" mtime=now()"
" WHERE login=%Q;",
zLogin, P("pw"), zLogin, P("info"), zCap,
zOldLogin
);
login_group_sql(blob_str(&sql), "<li> ", " </li>\n", &zErr);
blob_reset(&sql);
if( zErr ){
style_header("User Change Error");
@ <span class="loginError">%s(zErr)</span>
@
@ <p><a href="setup_uedit?id=%d(uid)">[Bummer]</a></p>
style_footer();
return;
}
}
| > > | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
" mtime=now()"
" WHERE login=%Q;",
zLogin, P("pw"), zLogin, P("info"), zCap,
zOldLogin
);
login_group_sql(blob_str(&sql), "<li> ", " </li>\n", &zErr);
blob_reset(&sql);
admin_log( "Updated user '%q' with capapbilities.", zLogin, zCap );
if( zErr ){
style_header("User Change Error");
admin_log( "Error updating user '%q': %s'.", zLogin, zErr );
@ <span class="loginError">%s(zErr)</span>
@
@ <p><a href="setup_uedit?id=%d(uid)">[Bummer]</a></p>
style_footer();
return;
}
}
|
| ︙ | ︙ |