Gazelle/sections/artist/delete_similar.php

33 lines
778 B
PHP
Raw Normal View History

2013-07-10 00:08:53 +00:00
<?php
2011-03-28 14:21:28 +00:00
authorize();
$SimilarID = db_string($_GET['similarid']);
2013-05-05 08:00:31 +00:00
if (!is_number($SimilarID) || !$SimilarID) {
2011-03-28 14:21:28 +00:00
error(404);
}
2013-05-05 08:00:31 +00:00
if (!check_perms('site_delete_tag')) {
2011-03-28 14:21:28 +00:00
error(403);
}
2013-07-10 00:08:53 +00:00
$DB->query("
SELECT ArtistID
FROM artists_similar
WHERE SimilarID = '$SimilarID'");
2011-03-28 14:21:28 +00:00
$ArtistIDs = $DB->to_array();
2013-07-10 00:08:53 +00:00
$DB->query("
DELETE FROM artists_similar
WHERE SimilarID = '$SimilarID'");
$DB->query("
DELETE FROM artists_similar_scores
WHERE SimilarID = '$SimilarID'");
$DB->query("
DELETE FROM artists_similar_votes
WHERE SimilarID = '$SimilarID'");
2011-03-28 14:21:28 +00:00
foreach ($ArtistIDs as $ArtistID) {
list($ArtistID) = $ArtistID;
2013-07-10 00:08:53 +00:00
$Cache->delete_value("artist_$ArtistID"); // Delete artist cache
$Cache->delete_value("similar_positions_$ArtistID");
2011-03-28 14:21:28 +00:00
}
header('Location: '.$_SERVER['HTTP_REFERER']);
?>