Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Delete Categories ?
Hello ,
I d like to know how categories can be deleted, as well as the users ?
0
This discussion has been closed.
Comments
i think deleting users must be done directly from the database at this point. if you don't want to do that, create a new role called "Deleted" (or something). Take away all the new role's privileges, and change the user to the new role.
right now i'd suggest this: go into category managment, edit the category, and uncheck all the roles so that no one can see that category. this will accomplish the same thing.
i don't know if it could be done without stored procedures.
first you'd have to find all the discussions in the category, then delete all the comments in each of those discussions from LUM_Comments. this would be an extremely tricky (and/or memory-intensive) join.
then you'd have to delete the discussions from LUM_Discussions, then delete the category from LUM_Categories, then delete all matching records with that category id from LUM_CategoryBlock and LUM_CategoryRoleBlock.
if it can be done in mysql i would like to see the query. (this is not sarcasm.)
DELETE FROM LUM_Comment INNER JOIN LUM_Discussion ON LUM_Comment.DiscussionID = LUM_Discussion.DiscussionID WHERE LUM_Discussion.CategoryID = [id of the category you want to delete] DELETE FROM LUM_Discussion WHERE LUM_Discussion.CategoryID = [id of the category you want to delete] DELETE FROM LUM_Category WHERE LUM_Category.CategoryID = [id of the category you want to delete]
I haven't tested it (don't have a spare vanilla db laying around) but it should work. If it destroys your tables, don't blame me...
you still need to add
DELETE FROM LUM_CategoryBlock WHERE CategoryID = [id of the category you want to delete] DELETE FROM LUM_CategoryRoleBlock WHERE CategoryID = [id of the category you want to delete]
to get all the scraps.
To maintain data integrity, they should go between my second and third queries.
As far as it being memory intensive, a join can't be much more than O(n2). I know the LUM_Comment table can get pretty big, but the LUM_Discussion table is guaranteed to have fewer records than LUM_Comment, and likely a *lot* fewer.
At any rate, that's the worst case; in reality I would guess that it would be very close to linear. I haven't spent much time looking at how MySQL executes something like this, but if it has any sort of optimization at all, it'll be fine.