function createAlbumsList() { global $collection, $transaction_open, $numdone, $doing_search; debuglog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", "TIMINGS", 4); debuglog("Starting Database Update From Collection", "TIMINGS", 4); $now = time(); foreach (array_keys($collection->artists) as $artistkey) { do_artist_database_stuff($artistkey, false); } $dur = format_time(time() - $now); debuglog("Database Update From Collection Took " . $dur, "TIMINGS", 4); debuglog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", "TIMINGS", 4); // Find tracks that have been removed if (!$doing_search) { debuglog("Starting Cruft Removal", "TIMINGS", 4); $now = time(); debuglog("Finding tracks that have been deleted", "MYSQL", 7); generic_sql_query("DELETE FROM Tracktable WHERE LastModified IS NOT NULL AND TTindex NOT IN\n\t \t(SELECT TTindex FROM Foundtracks) AND Hidden = 0", true); remove_cruft(); update_stat('ListVersion', ROMPR_COLLECTION_VERSION); update_track_stats(); $dur = format_time(time() - $now); debuglog("Cruft Removal Took " . $dur, "TIMINGS", 4); debuglog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", "TIMINGS", 4); } close_transaction(); }
function delete_track($ttid) { global $returninfo; if (remove_ttid($ttid)) { checkAlbumsAndArtists(); remove_cruft(); update_track_stats(); $returninfo['stats'] = alistheader(get_stat('ArtistCount'), get_stat('AlbumCount'), get_stat('TrackCount'), format_time(get_stat('TotalTime'))); print json_encode($returninfo); } else { header('HTTP/1.1 400 Bad Request'); } }