Sntaches

Started by sharpie, September 20, 2013, 12:09:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ndbj

for the future removal of torrents, check the function deletetorrent at your include/bittorrent.php
mine's like this:
function deletetorrent($id) {
  global $torrent_dir;
  mysql_query("DELETE FROM torrents WHERE id = $id");
  mysql_query("DELETE FROM torrentsd WHERE tid = $id");
  mysql_query("DELETE FROM snatched WHERE torrentid = $id");
  mysql_query("DELETE FROM bookmarks WHERE torrentid = $id");
  foreach(explode(".","peers.files.comments.ratings") as $x)
      mysql_query("DELETE FROM $x WHERE torrent = $id");
  unlink("$torrent_dir/$id.torrent");
}


now, if you want to remove snatches from already deleted torrents, at your phpmyadmin just run sql with something like this:
Delete 'snatches' from 'snatched' WHERE 'torrentid'<'1';

sharpie

thanks m8 will add queries and check back for other bit :P

MelvinMeow

Wherever you are already deleting your torrents from the site in your cleanup code you would simply add:
mysql_query("DELETE FROM snatched WHERE torrentid ={$arr['id']}");

To the same area where you see queries like this:
mysql_query("DELETE FROM torrents WHERE id={$arr['id']}");
mysql_query("DELETE FROM peers WHERE torrent={$arr['id']}");
mysql_query("DELETE FROM comments WHERE torrent={$arr['id']}");
mysql_query("DELETE FROM files WHERE torrent={$arr['id']}");
mysql_query("DELETE FROM snatched WHERE torrentid ={$arr['id']}");
mysql_query("DELETE FROM bookmarks WHERE torrentid ={$arr['id']}");


As far as existing torrents you would probably have to run some kind of query where if the torrent id does not equal the id of the snatched torrents id then delete the field.
Having a brain fart at the moment I will try and post the query tonight or tomorrow if I remember.

sharpie

#1
How do i delete snatches from the snatched table for torrents that dont exists for all members that i could run now in phpmyadmin or on a site clean up

Thanks in advance