Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Yuna Scatari Edition (YSE) (http://www.bvlist.com/forumdisplay.php?f=22)
-   -   [SOLVED] Disapeering Torrents - RC02 (http://www.bvlist.com/showthread.php?t=459)

snakebite 14th June 2008 10:39

[SOLVED] Disapeering Torrents - RC02
 
why does active torrents keep vanishing from the browse page?
although im seeding them...

im using Yuna Scatari v2.0 PRE7 RC2 By BoLaMN

kp380lv 14th June 2008 12:14

Re: active torrent problem
 
Quote:

Originally Posted by snakebite
why does active torrents keep vanishing from the browse page?
although im seeding them...

im using Yuna Scatari v2.0 PRE7 RC2 By BoLaMN

This problem was with TBDev v2.0 (18.05.07) Pre 6 RC 0 from http://bit-torrent.kiev.ua !I think problem is in announce.php or upload.php maybe i m wrong!

BoLaMN 14th June 2008 13:13

Re: active torrent problem
 
i reackon its in cleanup.php search for "-=" and that might be the problem ;) havent tested it though

Kotafi 14th June 2008 13:33

Re: active torrent problem
 
tested, works now :wild:

Change line 86 to $deadtime = $max_dead_torrent_time;

BoLaMN 14th June 2008 13:33

Re: active torrent problem
 
nope thats incorrect hmm its the same in every other sources its always $deadtime -=

Kotafi 14th June 2008 13:35

Re: active torrent problem
 
okhey but torrents are visible again :unknown:

snakebite 14th June 2008 14:22

Re: active torrent problem
 
Quote:

Originally Posted by Hatchet
tested, works now :wild:

Change line 86 to $deadtime = $max_dead_torrent_time;

tryed it...
didnt work for me...

Kotafi 14th June 2008 16:12

Re: active torrent problem
 
I have changed it back like it was and quess what, now the torrent visible again :rofl:
so its probaly something in the cleanup but dunno what :unknown:

snakebite 14th June 2008 17:00

Re: active torrent problem
 
Quote:

Originally Posted by Hatchet
I have changed it back like it was and quess what, now the torrent visible again :rofl:
so its probaly something in the cleanup but dunno what :unknown:

could you please give me your cleanup.php ;)

or maybe someone could look at my cleanup.php
Code:

/*********************************\
 DO NOT EDIT THIS FILE, PLEASE USE
 THE SETTINGS PANEL!!
\*********************************/

if(!defined('IN_TRACKER'))
  die('Hacking attempt!');

function docleanup() {
        global $torrent_dir, $signup_timeout, $max_dead_torrent_time, $autoclean_interval, $points_per_cleanup, $tracker_lang, $useoldtorrentstime, $oldtorrentstime, $inactiveusertime, $parkedacctime, $promote_gig_limit, $promote_min_ratio, $promote_min_reg_days, $demote_min_ratio, $leechwarn_remove_ratio, $leechwarn_gig_limit, $leechwarn_length, $leechwarn_length, $leechwarn_min_ratio;

        @set_time_limit(0);
        @ignore_user_abort(1);

        do {
                $res = sql_query('SELECT id FROM torrents');
                $ar = array();
                while ($row = mysql_fetch_array($res)) {
                        $id = $row[0];
                        $ar[$id] = 1;
                }

                if (!count($ar))
                        break;

                $dp = @opendir($rootpath.$torrent_dir);
                if (!$dp)
                        break;

                $ar2 = array();
                while (($file = @readdir($dp)) !== false) {
                        if (!preg_match('/^(\d+)\.torrent$/', $file, $m))
                                continue;
                        $id = $m[1];
                        $ar2[$id] = 1;
                        if (isset($ar[$id]) && $ar[$id])
                                continue;
                        $ff = $rootpath.$torrent_dir.'/'.$file;
                        @unlink($ff);
                }
                @closedir($dp);

                if (!count($ar2))
                        break;

                $delids = array();
                foreach (array_keys($ar) as $k) {
                        if (isset($ar2[$k]) && $ar2[$k])
                                continue;
                        $delids[] = $k;
                        unset($ar[$k]);
                }
                if (count($delids))
                        sql_query("DELETE FROM torrents WHERE id IN (" . join(",", $delids) . ")");

                $res = sql_query("SELECT torrent FROM peers GROUP BY torrent");
                $delids = array();
                while ($row = mysql_fetch_array($res)) {
                        $id = $row[0];
                        if (isset($ar[$id]) && $ar[$id])
                                continue;
                        $delids[] = $id;
                }
                if (count($delids))
                        sql_query("DELETE FROM peers WHERE torrent IN (" . join(",", $delids) . ")");

                $res = sql_query("SELECT torrent FROM files GROUP BY torrent");
                $delids = array();
                while ($row = mysql_fetch_array($res)) {
                        $id = $row[0];
                        if ($ar[$id])
                                continue;
                        $delids[] = $id;
                }
                if (count($delids))
                        sql_query("DELETE FROM files WHERE torrent IN (" . join(",", $delids) . ")");
        } while (0);

        $deadtime = deadtime();
        sql_query("DELETE FROM peers WHERE last_action < FROM_UNIXTIME($deadtime)");

        $deadtime = deadtime();
        sql_query("UPDATE snatched SET seeder='no' WHERE seeder='yes' AND last_action < FROM_UNIXTIME($deadtime)");

        $deadtime = $max_dead_torrent_time;
        sql_query("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < FROM_UNIXTIME($deadtime)");

        $torrents = array();
        $res = sql_query('SELECT torrent, seeder, COUNT(*) AS c FROM peers GROUP BY torrent, seeder');
        while ($row = mysql_fetch_array($res)) {
                if ($row['seeder'] == 'yes')
                        $key = 'seeders';
                else
                        $key = 'leechers';
                $torrents[$row['torrent']][$key] = $row['c'];
        }

        $res = sql_query('SELECT torrent, COUNT(*) AS c FROM comments GROUP BY torrent');
        while ($row = mysql_fetch_array($res))
                $torrents[$row['torrent']]['comments'] = $row['c'];

        $fields = explode(':', 'comments:leechers:seeders');
        $res = sql_query('SELECT id, seeders, leechers, comments FROM torrents');
        while ($row = mysql_fetch_array($res)) {
                $id = $row['id'];
                $torr = $torrents[$id];
                foreach ($fields as $field) {
                        if (!isset($torr[$field]))
                                $torr[$field] = 0;
                }
                $update = array();
                foreach ($fields as $field) {
                        if ($torr[$field] != $row[$field])
                                $update[] = $field . ' = ' . $torr[$field];
                }
                if (count($update))
                        sql_query("UPDATE torrents SET " . implode(",", $update) . " WHERE id = $id");
        }
       
       
                // delete inactive user accounts
        $secs = $inactiveusertime*86400;
        $dt = sqlesc(get_date_time(gmtime() - $secs));
        $maxclass = UC_POWER_USER;
        $res = sql_query("SELECT id FROM users WHERE parked='no' AND status='confirmed' AND class <= $maxclass AND last_access < $dt");
        if (mysql_num_rows($res) > 0) {
                while ($arr = mysql_fetch_array($res))
                {
                        sql_query("DELETE FROM users WHERE id = $arr[id]");
                        sql_query("DELETE FROM ".TABLE_PREFIX."users WHERE uid = $arr[id]");
                }
        }       
       
       
        // delete inactive parked user accounts
        $secs = $parkedacctime*86400;
        $dt = sqlesc(get_date_time(gmtime() - $secs));
        $maxclass = UC_POWER_USER;
        $res = sql_query("SELECT id FROM users WHERE parked='yes' AND status='confirmed' AND class <= $maxclass AND last_access < $dt");
        if (mysql_num_rows($res) > 0) {
                while ($arr = mysql_fetch_array($res))
                {
                        sql_query("DELETE FROM users WHERE id = $arr[id]");
                        sql_query("DELETE FROM ".TABLE_PREFIX."users WHERE uid = $arr[id]");
                }
        }

        // delete unconfirmed users if timeout.
        $deadtime = TIMENOW - $signup_timeout;       
        $res = sql_query("SELECT id FROM users WHERE status = 0 AND added < FROM_UNIXTIME($deadtime) AND last_login < FROM_UNIXTIME($deadtime) AND last_access < FROM_UNIXTIME($deadtime)");       
        if (mysql_num_rows($res) > 0) {
                while ($arr = mysql_fetch_array($res))
                {
                        sql_query("DELETE FROM users WHERE id = $arr[id]");
                        sql_query("DELETE FROM ".TABLE_PREFIX."users WHERE uid = $arr[id]");
                }
        }

        // Update seed bonus
        sql_query("UPDATE users SET bonus = bonus + $points_per_cleanup WHERE users.id IN (SELECT userid FROM peers WHERE seeder = 'yes')") or sqlerr(__FILE__,__LINE__);

        //remove vip statuses
        $now = sqlesc(get_date_time());
        $modcomment = sqlesc(date("Y-m-d") . " - VIP Status Expired.\n");
        $msg = sqlesc("Your VIP Status has now Expired.\n");
        $subject = sqlesc("Your VIP has Expired");
        sql_query("INSERT INTO messages (sender, receiver, added, msg, subject, poster) SELECT 0, id, $now, $msg, $subject, 0 FROM users WHERE vipuntil < ".TIMENOW." AND vipuntil <> '0'") or sqlerr(__FILE__,__LINE__);
        sql_query("UPDATE users SET class = oldclass, oldclass = 0, vipuntil = '0', modcomment = CONCAT($modcomment, modcomment) WHERE vipuntil < ".TIMENOW." AND vipuntil <> '0'") or sqlerr(__FILE__,__LINE__);

        // promote power users
        $limit = $promote_gig_limit*1024*1024*1024;
        $minratio = $promote_min_ratio;
        $maxdt = sqlesc(get_date_time(gmtime() - 86400*$promote_min_reg_days));
        $res = sql_query("SELECT id,modcomment FROM users WHERE class = '".UC_USER."' AND enabled = 'yes' AND uploaded >= $limit AND uploaded / downloaded >= $minratio AND added < $maxdt");
        if (mysql_num_rows($res) > 0)
        {
                $dt = sqlesc(get_date_time());
                $msg = sqlesc('Congratulations, you have been auto-promoted to Power User. :)');
                $subject = sqlesc('Promote!');
                while ($arr = mysql_fetch_array($res))
                {
                        $modcomment = htmlspecialchars($arr['modcomment']);
                        $modcomment =  gmdate("Y-m-d") . " - Promoted to POWER USER by -AutoSystem.\n". $modcomment;
                        $modcom =  sqlesc($modcomment);       
                        sql_query("UPDATE users SET class = '".UC_POWER_USER."', modcomment = $modcom WHERE id = $arr[id]");
                        sql_query("UPDATE ".TABLE_PREFIX."users SET usergroup = '".MYBB_POWER_USER."' WHERE uid = ".sqlesc($arr['id']));
                        sql_query("INSERT INTO messages (sender, subject, receiver, added, msg, poster) VALUES(0, $subject, $arr[id], $dt, $msg, 0)");
                }
        }

        // demote power users
        $minratio = $demote_min_ratio;       
        $res = sql_query("SELECT id,modcomment FROM users WHERE class = '".UC_POWER_USER."' AND uploaded / downloaded < $minratio");
        if (mysql_num_rows($res) > 0)
        {
                $dt = sqlesc(get_date_time());
                $msg = sqlesc('You have been auto-demoted from Power User to User because your share ratio has dropped below '.$minratio);
                $subject = sqlesc('Demote!');                               
                while ($arr = mysql_fetch_array($res))
                {
                        $modcomment = htmlspecialchars($arr['modcomment']);
                        $modcomment =  gmdate("Y-m-d") . " - Demoted to USER by -AutoSystem.\n". $modcomment;
                        $modcom =  sqlesc($modcomment);       
                        sql_query("UPDATE users SET class = '".UC_USER."', modcomment = $modcom WHERE id = $arr[id]");
                        sql_query("INSERT INTO messages (sender, subject, receiver, added, msg, poster) VALUES(0, $subject, $arr[id], $dt, $msg, 0)");
                }
        }
       
        // delete old torrents
        if ($useoldtorrentstime) {
                $days = $oldtorrentstime;
        $dt = sqlesc(get_date_time(gmtime() - ($days * 86400)));
        $res = sql_query('SELECT id, name FROM torrents WHERE added < '.$dt);
        while ($arr = mysql_fetch_array($res))
        {
                @unlink($rootpath.$torrent_dir.'/'.$arr['id'].'.torrent');
                sql_query('DELETE FROM torrents WHERE id='.$arr['id']);
                sql_query('DELETE FROM snatched WHERE torrentid='.$arr['id']);
                sql_query('DELETE FROM peers WHERE torrent='.$arr['id']);
                sql_query('DELETE FROM comments WHERE torrent='.$arr['id']);
                sql_query('DELETE FROM files WHERE torrent='.$arr['id']);
                sql_query("DELETE FROM ratings WHERE torrent=$arr[id]");
                sql_query("DELETE FROM checkcomm WHERE checkid=$arr[id] AND torrent = 1");
                sql_query("DELETE FROM bookmarks WHERE id=$arr[id]");
                write_log("Torrent $arr[id] ($arr[name]) was deleted by system (older than $days days)");
        }
        }
       

                // LEECHWARN USERS WITH LOW RATIO       
        $minratio = $leechwarn_min_ratio;
        $downloaded = $leechwarn_gig_limit*1024*1024*1024;
        $length = $leechwarn_length*7;
        $res = sql_query("SELECT id,modcomment FROM users WHERE class = '".UC_USER."' AND leechwarn = 'no' AND uploaded / downloaded < $minratio AND downloaded >= $downloaded");       
        if (mysql_num_rows($res) > 0)
                {
                        $dt = sqlesc(get_date_time());
                        $msg = sqlesc('You have been warned because of having low ratio. You need to get a ratio '.$leechwarn_remove_ratio.' before next '.$leechwarn_length.' weeks or your account will be banned.');
                        $subject = sqlesc('You have been Leech-Warned!');
                        $until = sqlesc(get_date_time(gmtime() + ($length*86400)));
                       
                        while ($arr = mysql_fetch_array($res))
                        {
                                $modcomment = htmlspecialchars($arr['modcomment']);
                                $modcomment =  gmdate("Y-m-d") . " - Leech-Warned by System - Low Ratio.\n". $modcomment;
                                $modcom =  sqlesc($modcomment);                                                       
                                sql_query("UPDATE users SET leechwarn = 'yes', leechwarnuntil = $until, modcomment = $modcom WHERE id=$arr[id]");
                                sql_query("INSERT INTO messages (sender, subject, receiver, added, msg, poster) VALUES(0, $subject, $arr[id], $dt, $msg, 0)");
                        }
                }       

        // REMOVE LEECHWARNING
        $minratio = $leechwarn_remove_ratio;
        $res = sql_query("SELECT id,modcomment FROM users WHERE leechwarn = 'yes' AND uploaded / downloaded >= $minratio");       
        if (mysql_num_rows($res) > 0)
        {
            $dt = sqlesc(get_date_time());
            $msg = sqlesc('Your warning of low ratio have been removed. We highly recommend you to keep a your ratio up to not be warned again.');
                $subject = sqlesc('Your Leech-Warning have been removed!');
            while ($arr = mysql_fetch_array($res))
            {
                        $modcomment = htmlspecialchars($arr['modcomment']);
                        $modcomment =  gmdate("Y-m-d") . " - Leech-Warning removed by System.\n". $modcomment;
                        $modcom =  sqlesc($modcomment);                       
                sql_query("UPDATE users SET leechwarn = 'no', leechwarnuntil = '0000-00-00 00:00:00', modcomment = $modcom WHERE id = $arr[id]");
                sql_query("INSERT INTO messages (sender, subject, receiver, added, msg, poster) VALUES(0, $subject, $arr[id], $dt, $msg, 0)");
            }
        }
       
        // REMOVE EXPIRED WARNINGS
        $res = sql_query("SELECT id,modcomment FROM users WHERE warned='yes' AND warneduntil < NOW() AND warneduntil <> '0000-00-00 00:00:00'");
        if (mysql_num_rows($res) > 0)
        {
                $dt = sqlesc(get_date_time());
                $msg = sqlesc("Your warning has been removed. Please keep in your best behaviour from now on.\n");
                $subject = sqlesc("Warning have been removed.");
                while ($arr = mysql_fetch_assoc($res))
                {
                        $modcomment = htmlspecialchars($arr['modcomment']);
                        $modcomment =  gmdate("Y-m-d") . " - Warning removed by System.\n". $modcomment;
                        $modcom =  sqlesc($modcomment);                               
                        sql_query("UPDATE users SET warned = 'no', warneduntil = '0000-00-00 00:00:00', modcomment = $modcom WHERE id = ".$arr['id']);                       
                        sql_query("INSERT INTO messages (sender, receiver, added, msg, subject, poster) VALUES(0, $arr[id], $dt, $msg, $subject, 0)");
                }
        }

        // BAN USERS WITH LEECHWARNING EXPIRED
        $dt = sqlesc(get_date_time());
        $res = sql_query('SELECT id,modcomment FROM users WHERE enabled = \'yes\' AND leechwarn = \'yes\' AND leechwarnuntil < '.$dt);
        if (mysql_num_rows($res) > 0)
        {
            while ($arr = mysql_fetch_array($res))
            {
                        $modcomment = htmlspecialchars($arr['modcomment']);
                        $modcomment =  gmdate("Y-m-d") . " - Banned by System because of Leech-Warning expired.\n". $modcomment;
                        $modcom =  sqlesc($modcomment);                       
                sql_query("UPDATE users SET enabled = 'no', leechwarnuntil = '0000-00-00 00:00:00', modcomment = $modcom WHERE id = $arr[id]");
                        sql_query("UPDATE ".TABLE_PREFIX."users SET usergroup = '".MYBB_BANNED."' WHERE uid = ".sqlesc($arr['id']));
            }
        }       


        // delete old regimage codes
        $secs = 1 * 86400;
        $dt = time() - $secs;
        sql_query("DELETE FROM captcha WHERE dateline < $dt") or sqlerr(__FILE__,__LINE__);

        $secs = 1 * 3600;
        $dt = time() - $secs;
        sql_query("DELETE FROM sessions WHERE time < $dt") or sqlerr(__FILE__,__LINE__);

}

?>

10x ;)

MIsteRS 14th June 2008 18:24

Re: active torrent problem
 
Mh...... :(


All times are GMT +2. The time now is 01:57.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.