Exemple #1
0
 $InactivityExceptionsMade = array();
 $i = 0;
 foreach ($Torrents as $Torrent) {
     list($ID, $GroupID, $Name, $Format, $Encoding, $UserID, $Media, $InfoHash) = $Torrent;
     if (array_key_exists($UserID, $InactivityExceptionsMade) && time() < $InactivityExceptionsMade[$UserID]) {
         // don't delete the torrent!
         continue;
     }
     $ArtistName = Artists::display_artists(Artists::get_artist($GroupID), false, false, false);
     if ($ArtistName) {
         $Name = "{$ArtistName} - {$Name}";
     }
     if ($Format && $Encoding) {
         $Name .= ' [' . (empty($Media) ? '' : "{$Media} / ") . "{$Format} / {$Encoding}]";
     }
     Torrents::delete_torrent($ID, $GroupID);
     $LogEntries[] = db_string("Torrent {$ID} ({$Name}) (" . strtoupper($InfoHash) . ") was deleted for inactivity (unseeded)");
     if (!array_key_exists($UserID, $DeleteNotes)) {
         $DeleteNotes[$UserID] = array('Count' => 0, 'Msg' => '');
     }
     $DeleteNotes[$UserID]['Msg'] .= "\n{$Name}";
     $DeleteNotes[$UserID]['Count']++;
     ++$i;
     if ($i % 500 == 0) {
         echo "{$i} inactive torrents removed.\n";
     }
 }
 echo "{$i} torrents deleted for inactivity.\n";
 foreach ($DeleteNotes as $UserID => $MessageInfo) {
     $Singular = $MessageInfo['Count'] == 1 ? true : false;
     Misc::send_pm($UserID, 0, $MessageInfo['Count'] . ' of your torrents ' . ($Singular ? 'has' : 'have') . ' been deleted for inactivity', ($Singular ? 'One' : 'Some') . ' of your uploads ' . ($Singular ? 'has' : 'have') . ' been deleted for being unseeded. Since ' . ($Singular ? 'it' : 'they') . ' didn\'t break any rules (we hope), please feel free to re-upload ' . ($Singular ? 'it' : 'them') . ".\n\nThe following torrent" . ($Singular ? ' was' : 's were') . ' deleted:' . $MessageInfo['Msg']);
Exemple #2
0
     list($GroupID) = $DB->next_record();
     $Cache->delete_value("torrents_details_{$GroupID}");
     $SendPM = true;
 }
 //Log and delete
 if (isset($Escaped['delete']) && check_perms('users_mod')) {
     $DB->query("\n\t\t\tSELECT Username\n\t\t\tFROM users_main\n\t\t\tWHERE ID = {$UploaderID}");
     list($UpUsername) = $DB->next_record();
     $Log = "Torrent {$TorrentID} ({$RawName}) uploaded by {$UpUsername} was deleted by " . $LoggedUser['Username'];
     $Log .= $Escaped['resolve_type'] == 'custom' ? '' : ' for the reason: ' . $ResolveType['title'] . ".";
     if (isset($Escaped['log_message']) && $Escaped['log_message'] != '') {
         $Log .= ' ( ' . $Escaped['log_message'] . ' )';
     }
     $DB->query("\n\t\t\tSELECT GroupID, hex(info_hash)\n\t\t\tFROM torrents\n\t\t\tWHERE ID = {$TorrentID}");
     list($GroupID, $InfoHash) = $DB->next_record();
     Torrents::delete_torrent($TorrentID, 0, $ResolveType['reason']);
     //$InfoHash = unpack("H*", $InfoHash);
     $Log .= ' (' . strtoupper($InfoHash) . ')';
     Misc::write_log($Log);
     $Log = 'deleted torrent for the reason: ' . $ResolveType['title'] . '. ( ' . $Escaped['log_message'] . ' )';
     Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], $Log, 0);
 } else {
     $Log = "No log message (torrent wasn't deleted).";
 }
 //Warnings / remove upload
 if ($Upload) {
     $Cache->begin_transaction("user_info_heavy_{$UploaderID}");
     $Cache->update_row(false, array('DisableUpload' => '1'));
     $Cache->commit_transaction(0);
     $DB->query("\n\t\t\tUPDATE users_info\n\t\t\tSET DisableUpload = '1'\n\t\t\tWHERE UserID = {$UploaderID}");
 }