Browse Source

Don't make a query for each freeleech torrent

spaghetti 1 year ago
parent
commit
d6756fe912
1 changed files with 2 additions and 9 deletions
  1. 2
    9
      classes/torrents.class.php

+ 2
- 9
classes/torrents.class.php View File

@@ -687,18 +687,11 @@ class Torrents {
687 687
     }
688 688
     if ($Data['FreeTorrent'] == '1') {
689 689
       if ($Data['FreeLeechType'] == '3') {
690
-        $QueryID = G::$DB->get_query_id();
691
-        G::$DB->query("
692
-          SELECT UNIX_TIMESTAMP(ExpiryTime)
693
-          FROM shop_freeleeches
694
-          WHERE TorrentID = ?", $Data['ID']);
695
-        if (G::$DB->has_results()) {
696
-          $ExpiryTime = G::$DB->next_record(MYSQLI_NUM, false)[0];
697
-          $Info[] = ($HTMLy ? Format::torrent_label('Freeleech!') : 'Freeleech!') . ($HTMLy ? " <strong>(" : " (") . str_replace(['week','day','hour','min','Just now','s',' '],['w','d','h','m','0m'],time_diff(max($ExpiryTime, time()), 1, false)) . ($HTMLy ? ")</strong>" : ")");
690
+        if ($Data['ExpiryTime']) {
691
+          $Info[] = ($HTMLy ? Format::torrent_label('Freeleech!') : 'Freeleech!') . ($HTMLy ? " <strong>(" : " (") . str_replace(['week','day','hour','min','Just now','s',' '],['w','d','h','m','0m'],time_diff(max(strtotime($Data['ExpiryTime']), time()), 1, false)) . ($HTMLy ? ")</strong>" : ")");
698 692
         } else {
699 693
           $Info[] = $HTMLy ? Format::torrent_label('Freeleech!') : 'Freeleech!';
700 694
         }
701
-        G::$DB->set_query_id($QueryID);
702 695
       } else {
703 696
         $Info[] = $HTMLy ? Format::torrent_label('Freeleech!') : 'Freeleech!';
704 697
       }

Loading…
Cancel
Save