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.

deletion_warning.php 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?
  2. // Send warnings to uploaders of torrents that will be deleted this week
  3. $DB->query("
  4. SELECT
  5. t.ID,
  6. t.GroupID,
  7. tg.Name,
  8. t.UserID
  9. FROM torrents AS t
  10. JOIN torrents_group AS tg ON tg.ID = t.GroupID
  11. JOIN users_info AS u ON u.UserID = t.UserID
  12. WHERE t.last_action < NOW() - INTERVAL 20 DAY
  13. AND t.last_action != 0
  14. AND u.UnseededAlerts = '1'
  15. ORDER BY t.last_action ASC");
  16. $TorrentIDs = $DB->to_array();
  17. $TorrentAlerts = array();
  18. foreach ($TorrentIDs as $TorrentID) {
  19. list($ID, $GroupID, $Name, $UserID) = $TorrentID;
  20. if (array_key_exists($UserID, $InactivityExceptionsMade) && (time() < $InactivityExceptionsMade[$UserID])) {
  21. // don't notify exceptions
  22. continue;
  23. }
  24. if (!array_key_exists($UserID, $TorrentAlerts))
  25. $TorrentAlerts[$UserID] = array('Count' => 0, 'Msg' => '');
  26. $ArtistName = Artists::display_artists(Artists::get_artist($GroupID), false, false, false);
  27. if ($ArtistName) {
  28. $Name = "$ArtistName - $Name";
  29. }
  30. $TorrentAlerts[$UserID]['Msg'] .= "\n[url=".site_url()."torrents.php?torrentid=$ID]".$Name."[/url]";
  31. $TorrentAlerts[$UserID]['Count']++;
  32. }
  33. foreach ($TorrentAlerts as $UserID => $MessageInfo) {
  34. 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.");
  35. }
  36. ?>