BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

shop_freeleech.php 889B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. #declare(strict_types=1);
  3. // BP shop freeleeches
  4. $date = date('Y-m-d H:i:s');
  5. $DB->query("
  6. SELECT DISTINCT t.GroupID, sf.TorrentID
  7. FROM shop_freeleeches AS sf
  8. JOIN torrents AS t
  9. ON sf.TorrentID = t.ID
  10. WHERE
  11. sf.ExpiryTime < '".$date."'");
  12. $TorrentIDs = [];
  13. if ($DB->has_results()) {
  14. while (list($GroupID, $TorrentID) = $DB->next_record()) {
  15. $TorrentIDs[] = $TorrentID;
  16. $Cache->delete_value("torrents_details_$GroupID");
  17. $Cache->delete_value("torrent_group_$GroupID");
  18. }
  19. Torrents::freeleech_torrents($TorrentIDs, 0, 0);
  20. $DB->query("
  21. DELETE FROM shop_freeleeches
  22. WHERE ExpiryTime < '".$date."'");
  23. $Cache->delete_value('shop_freeleech_list');
  24. }
  25. // Also clear misc table for expired freeleech
  26. $DB->query("
  27. DELETE FROM misc
  28. WHERE Second = 'freeleech'
  29. AND CAST(First AS UNSIGNED INTEGER) < " . date('U'));