public static function remove_type($type, $delete = false)
{
if ($delete) {
// Delete comments of this type, delete type
$type_id = Comment::type($type);
DB::delete(DB::table('comments'), array('type' => $type_id));
DB::exec('DELETE FROM {commentinfo} WHERE comment_id IN (SELECT {commentinfo}.comment_id FROM {commentinfo} LEFT JOIN {comments} ON {commentinfo}.comment_id = {comments}.id WHERE {comments}.id IS NULL)');
DB::delete(DB::table('commenttype'), array('name' => Comment::type_name($type)));
} else {
DB::update(DB::table('commenttype'), array('name' => Comment::type_name($type), 'active' => 0), array('name'));
}
}