summaryrefslogtreecommitdiffstats
path: root/lib/class/album.class.php
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2013-01-25 21:08:24 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-01-25 21:45:47 -0500
commit1069d54c85149ff1cb51563d6a1fc471695f8b47 (patch)
treee5c22762ef4d6c90dcdb3646a04de26e21ad071c /lib/class/album.class.php
parentcad1380737f7ffcfa82d46ab3066823435a48a5d (diff)
downloadampache-1069d54c85149ff1cb51563d6a1fc471695f8b47.tar.gz
ampache-1069d54c85149ff1cb51563d6a1fc471695f8b47.tar.bz2
ampache-1069d54c85149ff1cb51563d6a1fc471695f8b47.zip
Move clean functions into their respective classes
Uniformly name them gc()
Diffstat (limited to 'lib/class/album.class.php')
-rw-r--r--lib/class/album.class.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/class/album.class.php b/lib/class/album.class.php
index c32cf007..16ef541d 100644
--- a/lib/class/album.class.php
+++ b/lib/class/album.class.php
@@ -89,6 +89,15 @@ class Album extends database_object {
} // construct_from_array
/**
+ * gc
+ *
+ * Cleans out unused albums
+ */
+ public static function gc() {
+ Dba::write('DELETE FROM `album` USING `album` LEFT JOIN `song` ON `song`.`album` = `album`.`id` WHERE `song`.`id` IS NULL');
+ }
+
+ /**
* build_cache
* This takes an array of object ids and caches all of their information
* with a single query
@@ -305,7 +314,7 @@ class Album extends database_object {
Song::update_artist($artist,$song_id);
}
$updated = 1;
- Catalog::clean_artists();
+ Artist::gc();
}
$album_id = Catalog::check_album($name,$year,$disk,$mbid);
@@ -317,7 +326,7 @@ class Album extends database_object {
}
$current_id = $album_id;
$updated = 1;
- Catalog::clean_albums();
+ self::gc();
}
if ($updated) {
@@ -326,7 +335,8 @@ class Album extends database_object {
Flag::add($song_id,'song','retag','Interface Album Update');
Song::update_utime($song_id);
} // foreach song of album
- Catalog::clean_stats();
+ Stats::gc();
+ Rating::gc();
} // if updated