diff options
Diffstat (limited to 'aurweb/scripts/usermaint.py')
-rwxr-xr-x | aurweb/scripts/usermaint.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/aurweb/scripts/usermaint.py b/aurweb/scripts/usermaint.py new file mode 100755 index 00000000..1621d410 --- /dev/null +++ b/aurweb/scripts/usermaint.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import time + +import aurweb.db + + +def main(): + conn = aurweb.db.Connection() + + limit_to = int(time.time()) - 86400 * 7 + conn.execute("UPDATE Users SET LastLoginIPAddress = NULL " + + "WHERE LastLogin < ?", [limit_to]) + conn.execute("UPDATE Users SET LastSSHLoginIPAddress = NULL " + + "WHERE LastSSHLogin < ?", [limit_to]) + + conn.commit() + conn.close() + + +if __name__ == '__main__': + main() |