From 813fff63d0f574d76e7e078825261079ba9bec65 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Thu, 7 Sep 2023 16:52:24 +0700 Subject: [PATCH] Fixed null seeders & leechers in announcer (#891) --- bt/announce.php | 8 ++++---- bt/scrape.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bt/announce.php b/bt/announce.php index 06244a5f6..0800cf618 100644 --- a/bt/announce.php +++ b/bt/announce.php @@ -207,7 +207,7 @@ if ($lp_info) { $row = DB()->fetch_row($sql); if (empty($row['topic_id'])) { - msg_die('Torrent not registered, info_hash = ' . bin2hex($info_hash_sql)); + msg_die('Torrent not registered, info_hash = ' . bin2hex($info_hash)); } if (empty($row['user_id'])) { msg_die('Please LOG IN and REDOWNLOAD this torrent (user not found)'); @@ -408,16 +408,16 @@ if (!$output) { LIMIT 1 "); - $seeders = $row['seeders']; - $leechers = $row['leechers']; + $seeders = $row['seeders'] ?? 0; + $leechers = $row['leechers'] ?? 0; } $output = [ 'interval' => (int)$announce_interval, 'min interval' => (int)$announce_interval, - 'peers' => $peers, 'complete' => (int)$seeders, 'incomplete' => (int)$leechers, + 'peers' => $peers, ]; $peers_list_cached = CACHE('tr_cache')->set(PEERS_LIST_PREFIX . $topic_id, $output, PEERS_LIST_EXPIRE); diff --git a/bt/scrape.php b/bt/scrape.php index 0bb09243b..3d3edc0b0 100644 --- a/bt/scrape.php +++ b/bt/scrape.php @@ -68,7 +68,7 @@ $row = DB()->fetch_row(" "); if (!$row) { - msg_die('Torrent not registered, info_hash = ' . bin2hex($info_hash_sql)); + msg_die('Torrent not registered, info_hash = ' . bin2hex($info_hash)); } $output['files'][$info_hash] = [