mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 12:47:13 +02:00
* Functional last callers mod
* Notes * Some cleanup
This commit is contained in:
parent
99ea870ebc
commit
4a342ba2fa
8 changed files with 126 additions and 222 deletions
|
@ -40,29 +40,21 @@ function login(callingMenu, formData, extraArgs) {
|
|||
});
|
||||
},
|
||||
function recordLoginHistory(callback) {
|
||||
userDb.run(
|
||||
'INSERT INTO user_login_history (user_id, user_name, timestamp) ' +
|
||||
'VALUES(?, ?, ?);', [ user.userId, user.username, now.toISOString() ], function inserted(err) {
|
||||
callback(err);
|
||||
});
|
||||
|
||||
userDb.serialize(function serialized() {
|
||||
userDb.run(
|
||||
'INSERT INTO user_login_history (user_id, user_name, timestamp) ' +
|
||||
'VALUES(?, ?, ?);', [ user.userId, user.username, now.toISOString() ]
|
||||
);
|
||||
|
||||
/*
|
||||
userDb.run(
|
||||
'DELETE FROM last_caller ' +
|
||||
'WHERE id NOT IN (' +
|
||||
' SELECT id ' +
|
||||
' FROM last_caller ' +
|
||||
' ORDER BY timestamp DESC ' +
|
||||
' LIMIT 100);');
|
||||
// keep 30 days of records
|
||||
userDb.run(
|
||||
'DELETE FROM user_login_history ' +
|
||||
'WHERE timestamp <= DATETIME("now", "-30 day");'
|
||||
);
|
||||
});
|
||||
|
||||
userDb.run(
|
||||
'DELETE FROM last_caller ' +
|
||||
'WHERE user_id IN (' +
|
||||
' SELECT user_id ' +
|
||||
' ORDER BY timestamp DESC ' +
|
||||
'LIMIT 1;')
|
||||
*/
|
||||
callback(null);
|
||||
}
|
||||
],
|
||||
function complete(err, results) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue