From 1069d54c85149ff1cb51563d6a1fc471695f8b47 Mon Sep 17 00:00:00 2001 From: Paul Arthur Date: Fri, 25 Jan 2013 21:08:24 -0500 Subject: Move clean functions into their respective classes Uniformly name them gc() --- lib/class/shoutbox.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/class/shoutbox.class.php') diff --git a/lib/class/shoutbox.class.php b/lib/class/shoutbox.class.php index ce85813d..3cface18 100644 --- a/lib/class/shoutbox.class.php +++ b/lib/class/shoutbox.class.php @@ -59,6 +59,17 @@ class shoutBox { } // _get_info + /** + * gc + * + * Cleans out orphaned shoutbox items + */ + public static function gc() { + foreach(array('song', 'album', 'artist') as $object_type) { + Dba::write("DELETE FROM `user_shout` USING `user_shout` LEFT JOIN `$object_type` ON `$object_type`.`id` = `user_shout`.`object_id` WHERE `$object_type`.`id` IS NULL AND `user_shout`.`object_type` = '$object_type'"); + } + } + /** * get_top * This returns the top user_shouts, shoutbox objects are always shown regardless and count against the total -- cgit