diff --git a/classes/class_artists.php b/classes/class_artists.php index 3500eccf..aff961c5 100644 --- a/classes/class_artists.php +++ b/classes/class_artists.php @@ -243,6 +243,7 @@ public static function delete_artist($ArtistID) { $DB->query('DELETE FROM artists_tags WHERE ArtistID='.$ArtistID); $Cache->delete_value('artist_'.$ArtistID); + $Cache->delete_value('artist_groups_'.$ArtistID); // Record in log if(!empty($LoggedUser['Username'])) { diff --git a/classes/class_lastfm.php b/classes/class_lastfm.php index c59fa114..40acb799 100644 --- a/classes/class_lastfm.php +++ b/classes/class_lastfm.php @@ -1,6 +1,5 @@ define('LASTFM_API_URL', 'http://ws.audioscrobbler.com/2.0/?method='); - class LastFM { public static function get_artist_events($ArtistID, $Artist, $Limit = 15) { @@ -14,12 +13,15 @@ public static function get_artist_events($ArtistID, $Artist, $Limit = 15) { } private static function lastfm_request($Method, $Args) { + if (!defined('LASTFM_API_KEY')) { + return false; + } $Url = LASTFM_API_URL.$Method; if(is_array($Args)) { foreach ($Args as $Key => $Value) { $Url .= "&".$Key."=".urlencode($Value); } - $Url .= "&format=json&api_key=".LASTFM_KEY; + $Url .= "&format=json&api_key=".LASTFM_API_KEY; $Curl=curl_init(); curl_setopt($Curl,CURLOPT_HEADER,0); diff --git a/classes/class_torrents.php b/classes/class_torrents.php index 59aca00c..2f7e09c4 100644 --- a/classes/class_torrents.php +++ b/classes/class_torrents.php @@ -210,14 +210,6 @@ public static function delete_torrent($ID, $GroupID=0, $OcelotReason=-1) { Torrents::delete_group($GroupID); } else { Torrents::update_hash($GroupID); - //Artists - $DB->query("SELECT ArtistID - FROM torrents_artists - WHERE GroupID = ".$GroupID); - $ArtistIDs = $DB->collect('ArtistID'); - foreach ($ArtistIDs as $ArtistID) { - $Cache->delete_value('artist_'.$ArtistID); - } } // Torrent notifications @@ -316,7 +308,7 @@ public static function delete_group($GroupID) { Artists::delete_artist($ArtistID); } else { //Not the only group, still need to clear cache - $Cache->delete_value('artist_'.$ArtistID); + $Cache->delete_value('artist_groups_'.$ArtistID); } } @@ -416,7 +408,7 @@ public static function update_hash($GroupID) { $ArtistInfo = Artists::get_artist($GroupID); foreach ($ArtistInfo as $Importances => $Importance) { foreach ($Importance as $Artist) { - $Cache->delete_value('artist_'.$Artist['id']); //Needed for at least freeleech change, if not others. + $Cache->delete_value('artist_groups_'.$Artist['id']); //Needed for at least freeleech change, if not others. } } diff --git a/design/privateheader.php b/design/privateheader.php index 445284ac..4268094e 100644 --- a/design/privateheader.php +++ b/design/privateheader.php @@ -169,7 +169,7 @@ $Cache->cache_value('subscriptions_user_new_'.$LoggedUser['ID'], $NewSubscriptions, 0); } ?> -
Artist | diff --git a/sections/torrents/editgroupid.php b/sections/torrents/editgroupid.php index c4224485..475e078d 100644 --- a/sections/torrents/editgroupid.php +++ b/sections/torrents/editgroupid.php @@ -81,12 +81,6 @@ } Torrents::update_hash($GroupID); - // Clear artist caches - $DB->query("SELECT DISTINCT ArtistID FROM torrents_artists WHERE GroupID IN ('$GroupID', '$OldGroupID')"); - while(list($ArtistID) = $DB->next_record()) { - $Cache->delete_value('artist_'.$ArtistID); - } - Misc::write_log("Torrent $TorrentID was edited by " . $LoggedUser['Username']); // TODO: this is probably broken Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "merged group ".$OldGroupID, 0); $DB->query("UPDATE group_log SET GroupID = ".$GroupID." WHERE GroupID = ".$OldGroupID); diff --git a/sections/torrents/manage_artists.php b/sections/torrents/manage_artists.php index 5bc1cc89..92080882 100644 --- a/sections/torrents/manage_artists.php +++ b/sections/torrents/manage_artists.php @@ -16,25 +16,24 @@ foreach($Artists as $i => $Artist) { list($Importance, $ArtistID) = explode(';',$Artist); if(is_number($ArtistID) && is_number($Importance)) { - $Cache->delete_value('artist_'.$ArtistID); $CleanArtists[] = array($Importance, $ArtistID); - $ArtistsString .= ",$ArtistID"; $ArtistIDs[] = $ArtistID; } } if(count($CleanArtists) > 0) { + $ArtistsString = implode(',', $ArtistIDs);; if($_POST['manager_action'] == 'delete') { $DB->query("SELECT Name FROM torrents_group WHERE ID = '".$_POST['groupid']."'"); list($GroupName) = $DB->next_record(); $DB->query("SELECT ArtistID, Name FROM artists_group WHERE ArtistID IN (".$ArtistsString.")"); $ArtistNames = $DB->to_array('ArtistID', MYSQLI_ASSOC, false); - print_r($ArtistNames); - foreach ($CleanArtists AS $Artist) { + foreach ($CleanArtists as $Artist) { list($Importance,$ArtistID) = $Artist; Misc::write_log("Artist (".$ArtistTypes[$Importance].") ".$ArtistID." (".$ArtistNames[$ArtistID]['Name'].") was removed from the group ".$_POST['groupid']." (".$GroupName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")"); Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "Removed artist ".$ArtistNames[$ArtistID]['Name']." (".$ArtistTypes[$Importance].")", 0); $DB->query("DELETE FROM torrents_artists WHERE GroupID = '$GroupID' AND ArtistID = '$ArtistID' AND Importance = '$Importance'"); + $Cache->delete_value('artist_groups_'.$ArtistID); } $DB->query("SELECT ArtistID FROM requests_artists @@ -51,6 +50,7 @@ $DB->query("UPDATE IGNORE torrents_artists SET Importance = '".$_POST['importance']."' WHERE GroupID = '$GroupID' AND ArtistID IN (".$ArtistsString.")"); } $Cache->delete_value('groups_artists_'.$GroupID); + Torrents::update_hash($GroupID); header("Location: torrents.php?id=".$GroupID); } ?> diff --git a/sections/torrents/merge.php b/sections/torrents/merge.php index 029d4043..3ffec808 100644 --- a/sections/torrents/merge.php +++ b/sections/torrents/merge.php @@ -119,12 +119,6 @@ $Cache->delete_value('torrent_download_'.$TorrentID); } $Cache->delete_value('torrents_details_'.$GroupID); - - $DB->query("SELECT DISTINCT ArtistID FROM torrents_artists WHERE GroupID IN ('$GroupID', '$OldGroupID')"); - while(list($ArtistID) = $DB->next_record()) { - $Cache->delete_value('artist_'.$ArtistID); - } - $Cache->delete_value('torrent_comments_'.$GroupID.'_catalogue_0'); $Cache->delete_value('torrent_comments_'.$GroupID); $Cache->delete_value('groups_artists_'.$GroupID); diff --git a/sections/torrents/rename.php b/sections/torrents/rename.php index 019766c2..852358cf 100644 --- a/sections/torrents/rename.php +++ b/sections/torrents/rename.php @@ -19,11 +19,6 @@ $DB->query("UPDATE torrents_group SET Name='".db_string($NewName)."' WHERE ID='$GroupID'"); $Cache->delete_value('torrents_details_'.$GroupID); -$DB->query("SELECT ArtistID FROM torrents_artists WHERE GroupID='$GroupID'"); -while(list($ArtistID) = $DB->next_record()) { - $Cache->delete_value('artist_'.$ArtistID); -} - Torrents::update_hash($GroupID); Misc::write_log("Torrent Group ".$GroupID." (".$OldName.") was renamed to '".$NewName."' by ".$LoggedUser['Username']); diff --git a/sections/torrents/takeedit.php b/sections/torrents/takeedit.php index cdd09158..d082250c 100644 --- a/sections/torrents/takeedit.php +++ b/sections/torrents/takeedit.php @@ -428,12 +428,6 @@ $Cache->delete_value('torrents_details_'.$GroupID); $Cache->delete_value('torrent_download_'.$TorrentID); -$DB->query("SELECT ArtistID FROM torrents_artists WHERE GroupID = ".$GroupID); -$Artists = $DB->collect('ArtistID'); -foreach($Artists as $ArtistID) { - $Cache->delete_value('artist_'.$ArtistID); -} - Torrents::update_hash($GroupID); // All done! diff --git a/sections/torrents/takegroupedit.php b/sections/torrents/takegroupedit.php index cf2db5fb..7021bd45 100644 --- a/sections/torrents/takegroupedit.php +++ b/sections/torrents/takegroupedit.php @@ -62,13 +62,6 @@ $DB->query("UPDATE torrents_group SET ReleaseType='$ReleaseType' WHERE ID='$GroupID'"); Torrents::update_hash($GroupID); - - $DB->query("SELECT ArtistID FROM torrents_artists WHERE GroupID = ".$GroupID); - $Artists = $DB->collect('ArtistID'); - foreach($Artists as $ArtistID) { - $Cache->delete_value('artist_'.$ArtistID); - } - } else { // revert $DB->query("SELECT PageID,Body,Image FROM wiki_torrents WHERE RevisionID='$RevisionID'"); @@ -100,7 +93,6 @@ // There we go, all done! -//$Cache->delete_value("artist_".$GroupID); // Delete artist cache $Cache->delete_value('torrents_details_'.$GroupID); $DB->query("SELECT CollageID FROM collages_torrents WHERE GroupID='$GroupID'"); if($DB->record_count()>0) { diff --git a/sections/torrents/takenewgroup.php b/sections/torrents/takenewgroup.php index 5c35f44c..89fe225c 100644 --- a/sections/torrents/takenewgroup.php +++ b/sections/torrents/takenewgroup.php @@ -15,8 +15,6 @@ $Year = trim($_POST['year']); $SearchText = db_string(trim($_POST['artist']) . ' ' . trim($_POST['title']) . ' ' . trim($_POST['year'])); -$OldArtistID = (int)$_POST['oldartistid']; // Doesn't hit the database, so we don't have to be especially paranoid - if(!is_number($OldGroupID) || !is_number($TorrentID) || !is_number($Year) || !$OldGroupID || !$TorrentID || !$Year || empty($Title) || empty($ArtistName)) { error(0); } @@ -60,8 +58,6 @@ Torrents::update_hash($GroupID); $Cache->delete_value('torrent_download_'.$TorrentID); -$Cache->delete_value('artist_'.$ArtistID); -$Cache->delete_value('artist_'.$OldArtistID); Misc::write_log("Torrent $TorrentID was edited by " . $LoggedUser['Username']); diff --git a/sections/upload/upload_handle.php b/sections/upload/upload_handle.php index 24e9dba4..f9258084 100644 --- a/sections/upload/upload_handle.php +++ b/sections/upload/upload_handle.php @@ -550,8 +550,6 @@ $AliasID = $DB->inserted_id(); $ArtistForm[$Importance][$Num] = array('id' => $ArtistID, 'aliasid' => $AliasID, 'name' => $Artist['name']); - } else { - $Cache->delete_value('artist_'.$Artist['id']); } } } @@ -935,13 +933,6 @@ // Clear Cache $Cache->delete('torrents_details_'.$GroupID); -foreach($ArtistForm as $Importance => $Artists) { - foreach($Artists as $Num => $Artist) { - if(!empty($Artist['id'])) { - $Cache->delete('artist_'.$Artist['id']); - } - } -} if (!$Private) { View::show_header("Warning");