From 4d053815c552e77ebbab55e9f48bacbea2559cd2 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sun, 12 Nov 2006 20:20:08 +0000 Subject: wups, wasnt cleaning up the playlist of objects with no votes --- lib/class/tmp_playlist.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/class/tmp_playlist.class.php b/lib/class/tmp_playlist.class.php index a262f3e8..4172583a 100644 --- a/lib/class/tmp_playlist.class.php +++ b/lib/class/tmp_playlist.class.php @@ -240,7 +240,7 @@ class tmpPlaylist { /** * prune_tracks - * This prunes tracks that don't have playlists + * This prunes tracks that don't have playlists or don't have votes */ function prune_tracks() { @@ -249,6 +249,13 @@ class tmpPlaylist { "WHERE tmp_playlist.id IS NULL"; $db_results = mysql_query($sql,dbh()); + $sql = "DELETE FROM tmp_playlist_data USING tmp_playlist_data " . + "LEFT JOIN user_vote ON tmp_playlist_data.id=user_vote.object_id " . + "WHERE user_vote.object_id IS NULL"; + $db_results = mysql_query($sql,dbh()); + + return true; + } // prune_tracks /** @@ -390,6 +397,9 @@ class tmpPlaylist { "WHERE user='$user_id' AND tmp_playlist_data.object_id='$object_id' " . "AND tmp_playlist_data.tmp_playlist='" . sql_escape($this->id) . "'"; $db_results = mysql_query($sql,dbh()); + + /* Clean up anything that has no votes */ + $this->prune_tracks(); return true; -- cgit