delete alias too when deleting pop/imap accounts, fixes #165

This commit is contained in:
Benjamin Sonntag 2017-08-12 16:54:31 +02:00
parent be63ec7192
commit dee8d6f1b8
1 changed files with 3 additions and 1 deletions

View File

@ -66,8 +66,10 @@ mysql_query "SELECT id, address_id, quote(replace(path,'!','\\!')) FROM mailbox
done done
# List the adresses to DELETE # List the adresses to DELETE
# delete aliases of this pop/imap email too :
mysql_query "DELETE r FROM recipient r LEFT JOIN address a ON r.address_id = a.id WHERE a.mail_action = 'DELETE' OR a.mail_action = 'DELETING';"
# Delete if only if there isn't any mailbox refering to it # Delete if only if there isn't any mailbox refering to it
mysql_query "delete a FROM address a LEFT JOIN mailbox m ON a.id = m.address_id WHERE m.id IS NULL AND (a.mail_action = 'DELETE' OR a.mail_action = 'DELETING');" mysql_query "DELETE a FROM address a LEFT JOIN mailbox m ON a.id = m.address_id WHERE m.id IS NULL AND (a.mail_action = 'DELETE' OR a.mail_action = 'DELETING');"
# Delete the lock # Delete the lock
rm -f "$LOCK_FILE" rm -f "$LOCK_FILE"