Thread: Dead torrents
View Single Post
  #4  
Old 14th August 2008, 08:32
Krypto Krypto is offline
Retired from BVList
 
Join Date: Jan 2008
P2P
Posts: 510
Default
Save this as dead.php

Code:
<?

require_once("include/bittorrent.php");

// delete dead torrents
	$res = mysql_query("SELECT id, name FROM torrents WHERE seeders=0 AND leechers=0 ");
	while ($arr = mysql_fetch_assoc($res))
	{
		@unlink("$torrent_dir/$arr[id].torrent");
		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]");
		write_log("Torrent $arr[id] ($arr[name]) was deleted by system, torrent dead");
	}
?>
Or just add the highlighted parts in to your cleanup file.

Not Tested, but should work

Last edited by Krypto; 14th August 2008 at 08:34.
Reply With Quote