removed extra queries

This commit is contained in:
Matthew Saunders Brown 2021-02-15 16:58:40 -08:00
parent 818a659ec6
commit 1018028f31

View File

@ -71,19 +71,11 @@ if [ -z "$mboxes_id" ]; then
exit 1
elif [ "$mboxes_id" -gt '0' ]; then
if [ -n "$force" ] || vmail::yesno "Delete $email now?"; then
# once ON DELETE CASCADE is set only this first query is needed for vm_* tables
# this should be sufficient for vm_* tables due to ON DELETE CASCADE foreign key references
dbquery="DELETE FROM vm_mboxes WHERE vm_mboxes.id='$mboxes_id'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM sa_userpref WHERE username='$email'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_aliases WHERE mbox_id='$mboxes_id'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_autoresponders WHERE mbox_id='$mboxes_id'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_filters WHERE mbox_id='$mboxes_id'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_forwards WHERE mbox_id='$mboxes_id'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_greylisting WHERE recipient='$email'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_greylisting WHERE recipient LIKE '$mbox+%@$domain'"