diff --git a/bin/vmail-mboxes-del.sh b/bin/vmail-mboxes-del.sh index 2907a68..a273467 100755 --- a/bin/vmail-mboxes-del.sh +++ b/bin/vmail-mboxes-del.sh @@ -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'"