Delete from DB already deleted users from Mastodon
This commit is contained in:
pare
294f8d5709
commit
10414f9dd4
S'han modificat 1 arxius amb 5 adicions i 3 eliminacions
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime, timezone, timedelta
|
||||
import time
|
||||
import threading
|
||||
import os
|
||||
|
@ -226,9 +226,11 @@ while i < len(inactive_users_id):
|
|||
email_datetime = email_datetime.replace(tzinfo=None)
|
||||
|
||||
if seen != None:
|
||||
reactivated = email_datetime < seen
|
||||
|
||||
if reactivated == True or seen == None: #if inactive user reactivated its account or deleted it we must delete related row from 'mailing_db_table'
|
||||
reactivated = email_datetime < seen
|
||||
last_year = datetime.today() - timedelta(days=365)
|
||||
|
||||
if reactivated == True or seen == None or seen > last_year: #if inactive user had reactivated its account or had deleted it we must delete related row from 'mailing_db_table'
|
||||
|
||||
cur.execute("DELETE FROM " + mailing_db_table + " where account_id=(%s)", (inactive_users_id[i],))
|
||||
print("Deleting user " + str(inactive_users_id[i]))
|
||||
|
|
Loading…
Referencia en una nova incidència