From 387ca35a9c11b1318cee2e34b5d12d3b20fa40c1 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 6 Sep 2023 14:00:11 +0300 Subject: [PATCH] add direct downloads indicator --- src/library/database.php | 11 +++++++++++ src/public/index.php | 11 ++++++++++- src/public/magnet.php | 11 ++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/library/database.php b/src/library/database.php index 0d605df..ae572a1 100644 --- a/src/library/database.php +++ b/src/library/database.php @@ -885,6 +885,17 @@ class Database { return (int) $query->fetch()->result; } + public function getMagnetToAcceptableSourceTotalByMagnetId(int $magnetId) : int { + + $this->_debug->query->select->total++; + + $query = $this->_db->prepare('SELECT COUNT(*) AS `result` FROM `magnetToAcceptableSource` WHERE `magnetId` = ?'); + + $query->execute([$magnetId]); + + return (int) $query->fetch()->result; + } + public function getMagnetToAddressTrackerSeedersSum() : int { $this->_debug->query->select->total++; diff --git a/src/public/index.php b/src/public/index.php index 45c7041..80eedd0 100644 --- a/src/public/index.php +++ b/src/public/index.php @@ -151,7 +151,8 @@ else ], 'seeders' => $db->getMagnetToAddressTrackerSeedersSumByMagnetId($magnet->magnetId), 'completed' => $db->getMagnetToAddressTrackerCompletedSumByMagnetId($magnet->magnetId), - 'leechers' => $db->getMagnetToAddressTrackerLeechersSumByMagnetId($magnet->magnetId) + 'leechers' => $db->getMagnetToAddressTrackerLeechersSumByMagnetId($magnet->magnetId), + 'directs' => $db->getMagnetToAcceptableSourceTotalByMagnetId($magnet->magnetId) ]; } } @@ -307,6 +308,14 @@ echo '' . PHP_EOL ?> leechers ?> + directs) { ?> + + + + + directs ?> + + star->status) { ?> diff --git a/src/public/magnet.php b/src/public/magnet.php index d9b5bfe..5005743 100644 --- a/src/public/magnet.php +++ b/src/public/magnet.php @@ -133,7 +133,8 @@ else ], 'seeders' => $db->getMagnetToAddressTrackerSeedersSumByMagnetId($magnet->magnetId), 'completed' => $db->getMagnetToAddressTrackerCompletedSumByMagnetId($magnet->magnetId), - 'leechers' => $db->getMagnetToAddressTrackerLeechersSumByMagnetId($magnet->magnetId) + 'leechers' => $db->getMagnetToAddressTrackerLeechersSumByMagnetId($magnet->magnetId), + 'directs' => $db->getMagnetToAcceptableSourceTotalByMagnetId($magnet->magnetId), ]; } @@ -288,6 +289,14 @@ echo '' . PHP_EOL ?> magnet->leechers ?> + magnet->directs) { ?> + + + + + magnet->directs ?> + + magnet->star->status) { ?>