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.

deletion_warning.php 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. #declare(strict_types=1);
  3. // Send warnings to uploaders of torrents that will be deleted this week
  4. $DB->query("
  5. SELECT
  6. t.ID,
  7. t.GroupID,
  8. COALESCE(NULLIF(tg.Name,''), NULLIF(tg.Title2,''), tg.NameJP) AS Name,
  9. t.UserID
  10. FROM torrents AS t
  11. JOIN torrents_group AS tg ON tg.ID = t.GroupID
  12. JOIN users_info AS u ON u.UserID = t.UserID
  13. WHERE t.last_action < NOW() - INTERVAL 20 DAY
  14. AND t.last_action != 0
  15. AND u.UnseededAlerts = '1'
  16. ORDER BY t.last_action ASC");
  17. $TorrentIDs = $DB->to_array();
  18. $TorrentAlerts = [];
  19. foreach ($TorrentIDs as $TorrentID) {
  20. list($ID, $GroupID, $Name, $UserID) = $TorrentID;
  21. if (array_key_exists($UserID, $InactivityExceptionsMade) && (time() < $InactivityExceptionsMade[$UserID])) {
  22. // Don't notify exceptions
  23. continue;
  24. }
  25. if (!array_key_exists($UserID, $TorrentAlerts)) {
  26. $TorrentAlerts[$UserID] = array('Count' => 0, 'Msg' => '');
  27. }
  28. $ArtistName = Artists::display_artists(Artists::get_artist($GroupID), false, false, false);
  29. if ($ArtistName) {
  30. $Name = "$ArtistName - $Name";
  31. }
  32. $TorrentAlerts[$UserID]['Msg'] .= "\n[url=".site_url()."torrents.php?torrentid=$ID]".$Name."[/url]";
  33. $TorrentAlerts[$UserID]['Count']++;
  34. }
  35. foreach ($TorrentAlerts as $UserID => $MessageInfo) {
  36. Misc::send_pm($UserID, 0, 'Unseeded torrent notification', $MessageInfo['Count']." of your uploads will be deleted for inactivity soon. Unseeded torrents are deleted after 4 weeks. If you still have the files, you can seed your uploads by ensuring the torrents are in your client and that they aren't stopped. You can view the time that a torrent has been unseeded by clicking on the torrent description line and looking for the \"Last active\" time. For more information, please go [url=".site_url()."wiki.php?action=article&amp;id=663]here[/url].\n\nThe following torrent".($MessageInfo['Count'] > 1 ? 's' : '').' will be removed for inactivity:'.$MessageInfo['Msg']."\n\nIf you no longer wish to receive these notifications, please disable them in your profile settings.");
  37. }