delete snatched check user and torrent

This commit is contained in:
xiaomlove
2024-12-17 13:12:58 +08:00
parent ca21b0b7fe
commit edadbf0048
4 changed files with 21 additions and 7 deletions

View File

@@ -3126,7 +3126,8 @@ function deletetorrent($id, $notify = false) {
$idStr = implode(', ', $idArr ?: [0]);
$torrent_dir = get_setting('main.torrent_dir');
\Nexus\Database\NexusDB::statement("DELETE FROM torrents WHERE id in ($idStr)");
\Nexus\Database\NexusDB::statement("DELETE FROM snatched WHERE torrentid in ($idStr)");
//delete by torrent, make sure user is deleted
\Nexus\Database\NexusDB::statement("DELETE FROM snatched WHERE torrentid in ($idStr) and not exists (select 1 from users where id = snatched.userid)");
foreach(array("peers", "files", "comments") as $x) {
\Nexus\Database\NexusDB::statement("DELETE FROM $x WHERE torrent in ($idStr)");
}