Mercurial > hgrepos > hgweb.cgi > s4
changeset 688:1aa16edc28e5
Partial Committing Starts:
For session-DB separation, prepare session db file.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 18 May 2020 19:07:52 +0900 |
parents | 19d28bbdbee8 |
children | 13fb1392d2f2 |
files | s4-funcs.sh |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/s4-funcs.sh Mon May 18 17:41:51 2020 +0900 +++ b/s4-funcs.sh Mon May 18 19:07:52 2020 +0900 @@ -16,6 +16,8 @@ querylog=${QUERYLOG:-$tmpdir/query.log} searchlog=${SEARCHLOG:-$tmpdir/search.log} workdb=$dbdir/tmpdata.sq3 +sessdb=$dbdir/sess.sq3 +sesstb=tmp.sess listentlimit=${LISTENTLIMIT:-30} admin=${ADMIN:-hostmaster@example.org} noreply=${NOREPLY:-noreply@example.org} @@ -371,6 +373,16 @@ exec 5> $sqi # Turning $sqi access through fd5 for continuous open state chmod o-r $tmpdir/error.out $tmpdir/debug.out rm $sqi + # Attach supplemental DB + cat >&5 <<-EOF + .output /dev/null + ATTACH DATABASE "$sessdb" AS tmp; + SELECT * FROM $sesstb; + CREATE TABLE IF NOT EXISTS $sesstb(user, skey, expire, UNIQUE(user, skey)); + DELETE FROM $sesstb WHERE expire < datetime('now', 'localtime'); + DELETE FROM $sesstb WHERE expire is NULL or expire = ''; + .output stdout + EOF } cleanup2() { # Dirty workaround for produced zombie processes if [ -n "$HTTP_USER_AGENT" ]; then # When called from httpd