Oppaitime'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 894B

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