diff options
-rw-r--r-- | lib/class/tmp_playlist.class.php | 12 |
1 files changed, 11 insertions, 1 deletions
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; |