public function remove_from_disk() { $deleted = true; $season_ids = $this->get_seasons(); foreach ($season_ids as $id) { $season = new TVShow_Season($id); $deleted = $season->remove_from_disk(); if (!$deleted) { debug_event('tvshow', 'Error when deleting the season `' . $id . '`.', 1); break; } } if ($deleted) { $sql = "DELETE FROM `tvshow` WHERE `id` = ?"; $deleted = Dba::write($sql, array($this->id)); if ($deleted) { Art::gc('tvshow', $this->id); Userflag::gc('tvshow', $this->id); Rating::gc('tvshow', $this->id); Shoutbox::gc('tvshow', $this->id); Useractivity::gc('tvshow', $this->id); } } return $deleted; }
/** * gc * * This is a wrapper function for all of the different cleaning * functions, it runs them in an order that resembles correctness. */ public static function gc() { debug_event('catalog', 'Database cleanup started', 5); Song::gc(); Album::gc(); Artist::gc(); Video::gc(); Art::gc(); Stats::gc(); Rating::gc(); Userflag::gc(); Useractivity::gc(); Playlist::gc(); Tmp_Playlist::gc(); Shoutbox::gc(); Tag::gc(); // TODO: use InnoDB with foreign keys and on delete cascade to get rid of garbage collection \Lib\Metadata\Repository\Metadata::gc(); \Lib\Metadata\Repository\MetadataField::gc(); debug_event('catalog', 'Database cleanup ended', 5); }
/** * gc * * This is a wrapper function for all of the different cleaning * functions, it runs them in an order that resembles correctness. */ public static function gc() { debug_event('catalog', 'Database cleanup started', 5); Song::gc(); Album::gc(); Artist::gc(); Art::gc(); Stats::gc(); Rating::gc(); Userflag::gc(); Playlist::gc(); Tmp_Playlist::gc(); Shoutbox::gc(); Tag::gc(); debug_event('catalog', 'Database cleanup ended', 5); }
public function remove_from_disk() { $deleted = true; $video_ids = $this->get_episodes(); foreach ($video_ids as $id) { $video = Video::create_from_id($id); $deleted = $video->remove_from_disk(); if (!$deleted) { debug_event('tvshow_season', 'Error when deleting the video `' . $id . '`.', 1); break; } } if ($deleted) { $sql = "DELETE FROM `tvshow_season` WHERE `id` = ?"; $deleted = Dba::write($sql, array($this->id)); if ($deleted) { Art::gc('tvshow_season', $this->id); Userflag::gc('tvshow_season', $this->id); Rating::gc('tvshow_season', $this->id); Shoutbox::gc('tvshow_season', $this->id); } } return $deleted; }
public function remove() { $sql = "DELETE FROM `label` WHERE `id` = ?"; $deleted = Dba::write($sql, array($this->id)); if ($deleted) { Art::gc('label', $this->id); Userflag::gc('label', $this->id); Rating::gc('label', $this->id); Shoutbox::gc('label', $this->id); Useractivity::gc('label', $this->id); } return $deleted; }
public function remove_from_disk() { $deleted = true; $song_ids = $this->get_songs(); foreach ($song_ids as $id) { $song = new Song($id); $deleted = $song->remove_from_disk(); if (!$deleted) { debug_event('album', 'Error when deleting the song `' . $id . '`.', 1); break; } } if ($deleted) { $sql = "DELETE FROM `album` WHERE `id` = ?"; $deleted = Dba::write($sql, array($this->id)); if ($deleted) { Art::gc('album', $this->id); Userflag::gc('album', $this->id); Rating::gc('album', $this->id); Shoutbox::gc('album', $this->id); Useractivity::gc('album', $this->id); } } return $deleted; }
/** * Remove the video from disk. */ public function remove_from_disk() { if (file_exists($this->file)) { $deleted = unlink($this->file); } else { $deleted = true; } if ($deleted === true) { $sql = "DELETE FROM `video` WHERE `id` = ?"; $deleted = Dba::write($sql, array($this->id)); if ($deleted) { Art::gc('video', $this->id); Userflag::gc('video', $this->id); Rating::gc('video', $this->id); Shoutbox::gc('video', $this->id); Useractivity::gc('video', $this->id); } } else { debug_event('video', 'Cannot delete ' . $this->file . 'file. Please check permissions.', 1); } return $deleted; }
public function remove_from_disk() { $deleted = true; $album_ids = $this->get_albums(); foreach ($album_ids as $id) { $album = new Album($id); $deleted = $album->remove_from_disk(); if (!$deleted) { debug_event('artist', 'Error when deleting the album `' . $id . '`.', 1); break; } } if ($deleted) { $sql = "DELETE FROM `artist` WHERE `id` = ?"; $deleted = Dba::write($sql, array($this->id)); if ($deleted) { Art::gc('artist', $this->id); Userflag::gc('artist', $this->id); Rating::gc('artist', $this->id); Shoutbox::gc('artist', $this->id); } } return $deleted; }