From 1bbc34079518b63e6c2a5a26adc971ad83b5c06b Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sun, 16 Jun 2024 12:24:04 +0700 Subject: [PATCH] Updated --- install/sql/mysql.sql | 2 +- library/includes/cron/jobs/tr_seed_bonus.php | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql index f05c83dc..65ac79ba 100644 --- a/install/sql/mysql.sql +++ b/install/sql/mysql.sql @@ -575,7 +575,7 @@ INSERT INTO `bb_cron` VALUES ('', '1', 'DS update stats', 'ds_update_stats.php', INSERT INTO `bb_cron` VALUES ('', '1', 'Flash topic view', 'flash_topic_view.php', 'interval', '', '', '255', '', '', '00:10:00', '1', '', '0', '1', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Clean search results', 'clean_search_results.php', 'interval', '', '', '255', '', '', '00:10:00', '1', '', '0', '1', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Tracker cleanup and dlstat', 'tr_cleanup_and_dlstat.php', 'interval', '', '', '20', '', '', '00:15:00', '1', '', '0', '1', '0'); -INSERT INTO `bb_cron` VALUES ('', '1', 'Accrual seedbonus', 'tr_seed_bonus.php', 'interval', '', '', '25', '', '', '00:15:00', '1', '', '0', '1', '0'); +INSERT INTO `bb_cron` VALUES ('', '1', 'Accrual seedbonus', 'tr_seed_bonus.php', 'interval', '', '', '25', '', '', '00:10:00', '1', '', '0', '1', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Make tracker snapshot', 'tr_make_snapshot.php', 'interval', '', '', '10', '', '', '00:10:00', '1', '', '0', '1', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Seeder last seen', 'tr_update_seeder_last_seen.php', 'interval', '', '', '255', '', '', '01:00:00', '1', '', '0', '1', '0'); INSERT INTO `bb_cron` VALUES ('', '1', 'Tracker dl-complete count', 'tr_complete_count.php', 'interval', '', '', '255', '', '', '06:00:00', '1', '', '0', '1', '0'); diff --git a/library/includes/cron/jobs/tr_seed_bonus.php b/library/includes/cron/jobs/tr_seed_bonus.php index 3cc379c2..d8397379 100644 --- a/library/includes/cron/jobs/tr_seed_bonus.php +++ b/library/includes/cron/jobs/tr_seed_bonus.php @@ -27,11 +27,20 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se $seed_bonus = unserialize($bb_cfg['seed_bonus_points']); $seed_release = unserialize($bb_cfg['seed_bonus_release']); + // ------- Fix: https://torrentpier.com/threads/nedostacha-sidbonusov.41139/post-94240 ------- // + $sql = "SELECT last_run + FROM " . BB_CRON . " + WHERE cron_script = '" . basename(__FILE__) . "' + LIMIT 1"; + $cron_runs = DB()->fetch_row($sql); + $cron_job_last_run = (TIMENOW - strtotime($cron_runs['last_run'])); // сколько сек прошло с прошлого запуска задачи + foreach($seed_bonus as $i => $points) { if (!$points || !$seed_release[$i]) continue; - $user_points = ((float) $points / 4); + // ------- Fix: https://torrentpier.com/threads/nedostacha-sidbonusov.41139/post-94240 ------- // + $user_points = ($cron_job_last_run < 3600) ? round((float)$points * ($cron_job_last_run / 3600), 2) : 0; // сколько сидбонусов заработали за эти секи $release = (int) $seed_release[$i]; $user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400); @@ -52,4 +61,4 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se } DB()->query("DROP TEMPORARY TABLE IF EXISTS tmp_bonus"); -} \ No newline at end of file +}